No import of Prelude
From HaskellWiki
(Difference between revisions)
(difference between the methods) |
m (→Question: grammar) |
||
| Line 1: | Line 1: | ||
== Question == | == Question == | ||
| - | Is it possible | + | Is it possible to not load the Prelude module when compiling a Haskell module? |
== Answer == | == Answer == | ||
Revision as of 02:49, 4 December 2010
1 Question
Is it possible to not load the Prelude module when compiling a Haskell module?
2 Answer
You can either do
import Prelude()
or add
{-# LANGUAGE NoImplicitPrelude #-}to the top of the module, or equivalently compile with -fno-implicit-prelude option.
import Prelude()
NoImplicitPrelude.
E.g. with the first method some functions are imported which are silently inserted for several syntactic constructs.
A bare untyped integral number is rewritten asfromIntegral num
Num a => a
and list generation syntax is rewritten as follows:
[n..]
enumFrom
[n..m]
enumFromTo
[n,o..]
enumFromThen
[n,o..m]
enumFromThenTo
There are some such for which even -fno-implicit-prelude isn't enough;
I think these are documented in the "bugs" section of the GHC manual.
3 See also
- Haskell-Cafe: Not to load Prelude
