Reputation: 53665
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?
Upvotes: 22
Views: 2711
Reputation: 6493
The accepted answer doesn't seem to work anymore. This does work in ghci 8.0.2.
Prelude> :set -XNoImplicitPrelude
Prelude> :m -Prelude
>
Upvotes: 4
Reputation: 38708
% 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'
However, I'm not sure about the instances and how ghci deals with them.
Is there a particular instance that you're concerned about?
Upvotes: 17