haskell - 没有 Prelude 的 ghci session

标签 haskell ghci

这个问题出现在#haskell irc 聊天中:

How can I start ghci without importing prelude?



可能的答案似乎很明显:

ghci -XNoImplicitPrelude, or load a file with import 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/

相关文章:

haskell - Snap Web 框架中的自定义 404

haskell - 使用 Haskell 范围 : Why would mapping a floating point function across a range cause it to return an extra element?

haskell - tryhaskell.org 似乎不支持 GHCi 命令

haskell - 导入单子(monad)状态

haskell - 如何配置 GHCi 保存的命令历史记录量?

haskell - 如何在 GHCI 中中止执行?

haskell - 无法使用 -interactive-print 在 ghci 中的每行之后打印时间戳

haskell - 快照框架 : Compiled splices and processing forms with digestive functors

haskell - 用于跟踪副作用的 Monad

haskell - Haskell 中类型之间的转换