Cabal 无法解析测试套件块中的构建依赖项

Cabal fails to parse build-depends in test-suite block

我正在尝试将测试添加到我正在处理的包中(我正在使用堆栈)。一切顺利,直到这一点。我是 运行 以下版本(与我的 ubuntu 一样最新):

cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library

Stack: Version 0.1.4.0, Git revision 3a665fe1bc52776041a1c25cc47734e691805b6c (1724 commits) X86_64

这是有问题的部分:

Test-Suite test-one
  main-is: Test.hs
  type: exitcode-stdio-1.0
  hs-source-dirs: test
  build-depends: base >= 4.7 && < 5
               , scotty >= 0.10.2
               , scotty-login-session
               , text
               , wai
               , wai-extra
               , HUnit
               , HTTP-4000

这是 stack/cabal 在尝试构建或测试时给出的错误:

Unable to parse cabal file <mypackage>.cabal: NoParse "build-depends" 44

44 是上面的构建依赖行。

这里发生了什么?我遵循了 Cabal 用户指南,但我的 google-fu 什么也没找到。 cabal 文件的其余部分已链接 here 以供参考。

如果有帮助,我的系统是 ubuntu 14.04 LTS。

最后一行应该是:

                 , HTTP

而不是 HTTP-4000。也许你想要 , HTTP >= 4000.

这里是关于这个问题的更多信息...

这是 Cabal 库中解析包名的代码 (link)

instance Text PackageName where
  disp (PackageName n) = Disp.text n
  parse = do
    ns <- Parse.sepBy1 component (Parse.char '-')
    return (PackageName (intercalate "-" ns))
    where
      component = do
        cs <- Parse.munch1 Char.isAlphaNum
        if all Char.isDigit cs then Parse.pfail else return cs
        -- each component must contain an alphabetic character, to avoid
        -- ambiguity in identifiers like foo-1 (the 1 is the version number).

注意最后的评论。也许曾经 build-depends: 接受了语法 name-version,例如aeson-0.10.0.0,后来更改为需要使用关系运算符,例如aeson == 0.10.0.0.

现在我们总是使用关系运算符,也许可以允许包名称包含全数字部分。

在任何情况下,foo-123x 之类的名称都是有效的包名称,因为第二个组件不全是数字。