尽管有堆栈解算器,但找不到模块“Test.Hspec”

Ste*_*and 5 dependencies haskell haskell-stack

这是我的stack.yaml文件声明hspec为额外的依赖项:

# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: lts-3.8  

# Local packages, usually specified by relative directory name
packages:
- '.'

# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps:
- hspec-2.2.0
Run Code Online (Sandbox Code Playgroud)

当我运行时stack solver,它说没有要做任何更改:

root@5d7daa2aec0a:/src/test_stack/a-test/src# stack solver
This command is not guaranteed to give you a perfect build plan
It's possible that even with the changes generated below, you will still need to do some manual tweaking
Asking cabal to calculate a build plan, please wait
No needed changes found

To automatically modify your stack.yaml file, rerun with '--modify-stack-yaml'
Run Code Online (Sandbox Code Playgroud)

这是我的源文件(只是为了检查我是否可以将 Hspec 与堆栈一起使用):

module Main where

import Test.Hspec


main :: IO ()
main = do
  putStrLn "hello world"
Run Code Online (Sandbox Code Playgroud)

当我跑步时stack build我得到:

2015-10-05 22:24:08.450413: [警告] 找不到模块 `Test.Hspec' @(stack_Bp003b8iWaEltr693pSPs:Stack.Build.Execute src/Stack/Build/Execute.hs:1241:35)

我认为stack solver确保额外的依赖关系没问题。

我做错了什么?这是我第一次使用堆栈。

dup*_*ode 1

虽然 stack 取代了 cabal-install(用于构建和安装软件包的命令行工具),但它仍然使用 Cabal 打包基础设施。build-depends特别是,这意味着使用 stack 构建的项目仍然是具有 .cabal 文件的 Cabal 兼容包,并且它们的所有依赖项都应在.cabal 文件的部分中列出并具有适当的版本范围。即使在stack.yaml文件extra-deps字段中也指定了依赖关系,这种情况也成立,因为该字段具有不同的目的(即,为堆栈提供构建包时要使用的确切版本)。