没有 Prelude 的 ghci 会话
这个问题出现在 #haskell irc 聊天中:
如何在不导入 prelude 的情况下启动 ghci?
可能的答案似乎很明显:
ghci -XNoImplicitPrelude
,或者使用import Prelude ()
加载文件
后者似乎可以工作,而前者却奇怪地不行。但是,import Prelude ()
从 Prelude 导入声明的实例,对吗?有没有更好的方法来创建 ghci 会话而不加载 Prelude?
This question arose on #haskell irc chat:
How can I start ghci without importing prelude?
The possible answer seemed obvious:
ghci -XNoImplicitPrelude
, or load a file withimport Prelude ()
The latter seems to work, while the former strangely does not. However, import Prelude ()
imports the declared instances from Prelude, right? Is there a better way of creating a ghci session without loading Prelude at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
但是,我不确定这些实例以及 ghci 如何处理它们。
您是否担心某个特定情况?
However, I'm not sure about the instances and how ghci deals with them.
Is there a particular instance that you're concerned about?
接受的答案似乎不再有效。这在 ghci 8.0.2 中有效。
The accepted answer doesn't seem to work anymore. This does work in ghci 8.0.2.