Cabal - 共享数据类型

时间:2012-11-01 18:41:27

标签: haskell cabal

我有一个名为Datatypes.hs的顶级文件。它暴露在我的cabal文件中。

library
    exposed-modules: Application
                     Foundation
                     Import
                     Settings
                     Settings.Development
                     Datatypes
                     Handler.Advise

我想在我的测试代码中使用Datatypes。这是我试过的

测试套件测试     类型:exitcode-stdio-1.0     main-is:tests / testclient.hs     hs-source-dirs :.,测试     ghc-options:-Wall

build-depends: base
             , Datatypes
             , conduit == 0.5.2.7
             , attoparsec-conduit == 0.5.0.2
             , transformers == 0.3.0.0
             , resourcet == 0.4.0.2
             , http-conduit                  >= 1.5        && < 1.7
             , utf8-string == 0.3.7
             , aeson == 0.6.0.2

我仍然抱怨没有定义testclient.hs中的数据类型。我正在做什么?现在我只需将我的数据类型粘贴到testclient.hs中,但我希望能够引用Datatypes.hs

1 个答案:

答案 0 :(得分:3)

您无法在build-depends字段中列出单个模块 - 请改用您的软件包名称。例如,请查看.cabal file for unordered-containers

test-suite strictness-properties
  hs-source-dirs: tests
  main-is: Strictness.hs
  type: exitcode-stdio-1.0

  build-depends:
    base,
    [...]
    unordered-containers