简体   繁体   English

包含haskell-stack conf文件中的扩展名

[英]include extensions in haskell-stack conf file

I want to add ViewPatterns extensions to my build and currently I do it by adding the following lines to package.yaml 我想在我的构建中添加ViewPatterns扩展,目前我通过将以下行添加到package.yaml来实现

ghc-options:
- -Wall
- -XViewPatterns

I get a warning: 我收到警告:

Warning: Instead of 'ghc-options: -XViewPatterns' use 'extensions:
ViewPatterns'

But, when I add an extensions field to package.yaml, I get the following: 但是,当我向package.yaml添加extensions字段时,我得到以下内容:

WARNING: Ignoring unknown field "extensions" in package description

Also, I could not find any definition of extensions in the official stack documentation. 另外,我在官方堆栈文档中找不到任何extensions定义。

Do not confuse stack with hpack . 不要将堆栈与hpack混淆。

package.yaml is actually read by hpack. package.yaml实际上是由hpack读取的。 But stack build command implicitly calls hpack to automatically convert into a cabal file, which may make you confused. 但是stack build命令隐式调用hpack来自动转换为cabal文件,这可能会让你感到困惑。

Anyway, to specify extensions in package.yaml, use default-extensions : 无论如何,要在package.yaml中指定扩展名,请使用default-extensions

default-extensions: ViewPatterns

extensions:目前不支持堆栈,请参阅此github 问题中的后续内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM