Could Not Find Module `Data.Map' -- It Is A Member Of The Hidden Package
Answer :
These general steps were helpful for me to resolve similar issues:
Use Hoogle or Stackage to find the package where the module resides
Note that Hoogle and Stackage are case-sensitive. Looking up
Data.Mapin Hoogle yields a list similar to the one below. Stackage has a slightly different style, but the basics are the same (mostly because it also uses Hoogle for lookup).
The lines in green under the result headings show the name(s) of the containing
(1) package(s) (in small caps) and
(2) module(s) (capitalized).

Open
project-name.cabalin project root and add required package underbuild-depends:library
hs-source-dirs:
src
build-depends:
base >= 4.7 && < 5
, containers
exposed-modules:
LibIssue
stack buildto download and build dependencies(or
stack ghciif you plan to use it in the REPL)
The reason you can import Data.Char and Data.List is that they are part of the package base, which is included with GHC and is always loaded with GHCi. By contrast, Data.Map is in the external library containers. One way to load it with stack ghci is to add a cabal file with a build-depends on containers. This will install it in the stack environment for xxxx, so it will then be accessible.
Comments
Post a Comment