这个问题出现在#haskell irc 聊天中:
How can I start ghci without importing prelude?
可能的答案似乎很明显:
ghci -XNoImplicitPrelude
, or load a file withimport Prelude ()
后者似乎有效,而前者奇怪的是没有。但是,
import Prelude ()
从 Prelude 导入声明的实例,对吗?有没有更好的方法来创建一个完全不加载 Prelude 的 ghci session ?
最佳答案
% ghci
GHCi, version 7.0.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> :m -Prelude
> :i map
Top level: Not in scope: `map'
> :i Eq
Top level: Not in scope: data constructor `Eq'
但是,我不确定这些实例以及 ghci 如何处理它们。
是否有您担心的特定实例?
关于haskell - 没有 Prelude 的 ghci session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7732594/