如何使Haskell Data.Map模块可用于通过堆栈工具和环境导入?

问题描述 投票:2回答:1

我想导入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

我的印象是,在正确指定所需模块的情况下,堆栈应为我的项目安装Data.Map

您能给我一些如何解决此问题的指示吗?

haskell haskell-stack
1个回答
3
投票
Hackage上没有

map软件包。如果查看the documentation of Data.Map的左上角,您会发现它是containers包的一部分:

Data.Map

Snapshot of upper left corner of Hackage documentation作为依赖项添加到containers文件:

package.yaml

© www.soinside.com 2019 - 2024. All rights reserved.