Как сделать модуль Haskell Data.Map доступным для импорта с помощью стека и среды? - PullRequest
2 голосов
/ 29 апреля 2020

Я бы хотел импортировать 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 для моего проекта.

Не могли бы вы дать мне указатель на то, как я могу решить эту проблему?

1 Ответ

3 голосов
/ 29 апреля 2020

На Hackage нет пакета map . Если вы посмотрите в верхнем левом углу документацию Data.Map, вы увидите, что она входит в пакет контейнеров :

Snapshot of upper left corner of Hackage documentation

Добавьте containers в качестве зависимости к вашему package.yaml файлу:

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