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

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

问题描述

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

First, I created a new workspace:

stack new xxxx
stack init
stack build

然后

cd xxx\app
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的阴谋文件.这会将它安装在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天全站免登陆