[Haskell-cafe] Re: Not to load Prelude
lemming at henning-thielemann.de
Fri Jan 11 17:36:14 EST 2008
On Fri, 11 Jan 2008, Luke Palmer wrote:
> So, when you write the number 3 in Haskell, GHC converts this to
> essentially (Prelude.fromInteger (3::Integer)) in its internal format.
> So it doesn't matter if you import Prelude (), Prelude's version of
> fromInteger still gets called. If you give -fno-implicit-prelude,
> then this is converted to simply (fromInteger (3::Integer)), without
> the hard-coded prelude reference. That means you could write your own
> version of fromInteger that does something different. A common usage
> for -fno-implicit-prelude (insofar as it is used at all, which is
> seldom) is to replace the standard Num hierarchy with a saner one,
> with numeric literals resolving to that one instead.
> There are a few other hard-coded references to Prelude in the internal
> format, but I don't remember what they are offhand.
> -fno-implicit-prelude gets rid of those, too.
For details, see:
I have summarized the answers so far:
More information about the Haskell-Cafe