如何使用堆栈工具和环境使 Haskell Data.Map 模块可用于导入?
How to have Haskell Data.Map module available for import with stack tool and environment?
我想导入 Data.Map
。我正在使用堆栈,在将地图添加到 package.yaml
到我的项目后,如下所示:
name: space-age
version: 1.2.0.6
dependencies:
- base
library:
exposed-modules: SpaceAge
source-dirs: src
ghc-options: -Wall
dependencies:
- map
# - foo # List here the packages you
# - bar # want to use in your solution.
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- space-age
- hspec
但是在执行stack ghci
的时候还是出现如下错误:
In the dependencies for space-age-1.2.0.6:
map needed, but the stack configuration has no specified version (no package with that name found, perhaps there is a typo in a package's build-depends or an
omission from the stack.yaml packages list?)
needed since space-age is a build target.
这里是项目的stack.yaml
:
resolver: lts-15.8
我的印象是,如果需要适当的模块规范,stack 应该为我的项目安装 Data.Map
。
能否请您指点一下如何解决这个问题?
Hackage 上没有 map 包。如果您查看 the documentation of Data.Map
的左上角,您会发现它是 containers 包的一部分:
将 containers
添加为 package.yaml
文件的依赖项:
library:
exposed-modules: SpaceAge
source-dirs: src
ghc-options: -Wall
dependencies:
- containers
我想导入 Data.Map
。我正在使用堆栈,在将地图添加到 package.yaml
到我的项目后,如下所示:
name: space-age
version: 1.2.0.6
dependencies:
- base
library:
exposed-modules: SpaceAge
source-dirs: src
ghc-options: -Wall
dependencies:
- map
# - foo # List here the packages you
# - bar # want to use in your solution.
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- space-age
- hspec
但是在执行stack ghci
的时候还是出现如下错误:
In the dependencies for space-age-1.2.0.6:
map needed, but the stack configuration has no specified version (no package with that name found, perhaps there is a typo in a package's build-depends or an
omission from the stack.yaml packages list?)
needed since space-age is a build target.
这里是项目的stack.yaml
:
resolver: lts-15.8
我的印象是,如果需要适当的模块规范,stack 应该为我的项目安装 Data.Map
。
能否请您指点一下如何解决这个问题?
Hackage 上没有 map 包。如果您查看 the documentation of Data.Map
的左上角,您会发现它是 containers 包的一部分:
将 containers
添加为 package.yaml
文件的依赖项:
library:
exposed-modules: SpaceAge
source-dirs: src
ghc-options: -Wall
dependencies:
- containers