Yu Shen
Yu Shen

Reputation: 2910

How to have Haskell Data.Map module available for import with stack tool and environment?

I'd like to import Data.Map. I'm using stack, after adding map to package.yaml to my project as follows:

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

But when executing stack ghci I still have the following error:

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.

Here is the project's stack.yaml:

resolver: lts-15.8

I have the impresson that with proper specification of modules needed, stack should install Data.Map for my project.

Could you please give me some pointer on how I can resolve this problem?

Upvotes: 1

Views: 1016

Answers (1)

Mark Seemann
Mark Seemann

Reputation: 233257

There's no map package on Hackage. If you look in the upper left corner of the documentation of Data.Map, you'll see that it's part of the containers package:

Snapshot of upper left corner of Hackage documentation

Add containers as a dependency to your package.yaml file:

library:
  exposed-modules: SpaceAge
  source-dirs: src
  ghc-options: -Wall
  dependencies:
  - containers

Upvotes: 3

Related Questions