为ghci中的模块相关命令指定包名
有没有办法为 ghci 中的 :browse
、:load
或 :module
命令指定模块的包名称(版本 6.12.x) 1) ?
有些模块名称不明确:
Prelude> :module Control.Monad.Cont
<no location info>:
Ambiguous module name `Control.Monad.Cont':
it was found in multiple packages: mtl-1.1.0.2 monads-fd-0.1.0.2
设置 -hide-package
选项是我唯一能做的避免歧义的事情吗?
Is there a way to specify the package name for a module for the :browse
, :load
or :module
commands in ghci (version 6.12.1) ?
Some module names are ambiguous:
Prelude> :module Control.Monad.Cont
<no location info>:
Ambiguous module name `Control.Monad.Cont':
it was found in multiple packages: mtl-1.1.0.2 monads-fd-0.1.0.2
Is setting the -hide-package
option the only thing I can do to avoid the ambiguity?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,是的。但这不一定是一个大问题,你可以在 ghci 中执行此操作:
GHC-7 更改日志上还有一个行项目让我认为包导入可以在命令行上运行,但事实并非如此似乎还没有(见下文)。更改注释说的是“GHCi 支持的完整导入语法”,我认为它必须排除扩展。
As far as I know, yes. But it doesn't have to be a big deal, you can do this inside ghci:
There was also a line-item on GHC-7 change log that made me think package imports would work on the command line, but it doesn't seem to yet (see below). The change comment said something like "full import syntax supported in GHCi", which must exclude extensions I suppose.
您可以使用
ghc-pkg
,例如,这就像在每个后续
ghc
调用上设置-hide-package
。通过 Cabal 显式依赖于 monads-fd 的软件包不会受到影响,但其他一切都会受到影响。当心!You can use
ghc-pkg
, e.g.This is like setting
-hide-package
on every subsequentghc
invocation. Packages explicitly depending onmonads-fd
via Cabal will not be affected, but everything else is. Watch out!