Could not find module `Data.Map' — It is a member of the hidden package

前端 未结 2 2094
粉色の甜心
粉色の甜心 2020-12-15 18:15

First, I created a new workspace:

stack new xxxx
stack init
stack build

then

cd xxx\\app
stack ghci
import Data.Map
         


        
2条回答
  •  孤街浪徒
    2020-12-15 19:05

    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.

提交回复
热议问题