找不到模块`Data.Map' -- 它是隐藏包的成员 [英] Could not find module `Data.Map' -- It is a member of the hidden package

查看:21
本文介绍了找不到模块`Data.Map' -- 它是隐藏包的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我创建了一个新的工作区:

First, I created a new workspace:

stack new xxxx
stack init
stack build

然后

cd xxxapp
stack ghci
import Data.Map

我可以导入其他模块,例如 Data.CharData.List,但我无法导入 Data.Map.GHCi 告诉我:

I can import other modules like Data.Char and Data.List, but I can't import Data.Map. GHCi told me:

Could not find module 'Data.Map'
 It is a member of the hidden package 'containers-0.5.7.1@containers-0.5.7.1'.`

推荐答案

您可以导入 Data.CharData.List 的原因是它们是包 base,它包含在 GHC 中,并且始终与 GHCi 一起加载.相比之下,Data.Map 位于外部库containers 中.使用 stack ghci 加载它的一种方法是在 containers 上添加一个带有 build-depends 的 cabal 文件.这会将其安装在 xxxx 的堆栈环境中,以便可以访问.

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.

这篇关于找不到模块`Data.Map' -- 它是隐藏包的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆