0

我有以下项目结构:

project
+ src
|___ Func.hs
+ test
|___ ASpec.hs
|___ BSpec.hs
|___ Spec.hs
|___ Utils.hs

我想从and导入Utils模块,遗憾的是默认情况下这似乎是不可能的。我也尝试在我的 cabal 文件中创建第二个部分,但我不能依赖它。我应该如何在我的 cabal 文件中表达这一点?ASpecBSpeclibrary

name:                project
version:             0.1.0.0
synopsis:            something
-- description:
homepage:            https://github.com/xx/project#readme
license:             BSD2
license-file:        LICENSE
author:              me
maintainer:          me@domail.tld
copyright:           2020 Me
category:            Text
build-type:          Simple
extra-source-files:  README.md
cabal-version:       >=1.10

library
  hs-source-dirs:      src
  ghc-options:         -Werror -fwarn-missing-methods
  exposed-modules:     Func
  build-depends:       base >= 4.12 && < 5
  default-language:    Haskell2010

test-suite project-test
  type:                exitcode-stdio-1.0
  hs-source-dirs:      test
  other-modules:       ASpec
                     , BSpec
  main-is:             Spec.hs
  build-depends:       base
                     , project
                     , hspec
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  default-language:    Haskell2010

source-repository head
  type:     git
  location: https://github.com/xx/project
4

0 回答 0