添加依赖 - 解析错误

时间:2016-05-12 01:33:28

标签: haskell cabal haskell-stack

创建新项目后:

$cd myproject
$stack new workbench
$cd workbench/
$stack setup

我尝试通过更新workbench.cabal

来添加此ZeroMQ库
$cat workbench.cabal 
name:                workbench

...

library
  hs-source-dirs:      src
  exposed-modules:     Lib
  build-depends:       base >= 4.7 && < 5    # my note: line 19
                       zeromq4-haskell
  default-language:    Haskell2010

但是,在运行stack clean时,我会得到以下信息:

$stack clean
Unable to parse cabal file .../workbench/workbench.cabal: NoParse "build-depends" 19

我做错了什么?

1 个答案:

答案 0 :(得分:2)

cabal文件中的任何列表必须以逗号分隔,而不是以空格分隔。有关.cabal个文件are listed in the user guide *的规则:

library
  hs-source-dirs:      src
  exposed-modules:     Lib
  build-depends:       base >= 4.7 && < 5,
                       zeromq4-haskell
  default-language:    Haskell2010

*有趣的是,那里缺少x list的定义。