[Haskell-cafe] Re: Not to load Prelude

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Jan 10 19:33:58 EST 2008


On Jan 10, 2008, at 19:16 , Maurí cio wrote:

> >> Hi,
> >>
> >> Is it possible not to load Prelude (...)
>
> >(...) NoImplicitPrelude is more aggressive
> > than 'import Prelude()'. You will have to
> > look elsewhere for a better explanation of
> > the difference.
>
> I tried google and ghc homepage, but could
> not find “elsewhere” :) Can you give me a
> link or somewhere to start from?

You'll find it in a careful reading of the Haskell98 Report:  certain  
syntactical constructs are rewritten into calls to Prelude  
functions.  Most notably:  a bare untyped integral number is  
rewritten as (fromIntegral num) (so its type will be (Num a => a)),  
and [n..m] list generation syntax is rewritten into calls to enumFrom  
([n..]), enumFromTo ([n..m]), enumFromThen ([n,o..]), enumFromThenTo  
([n,o..m]).

(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.)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list