[Haskell] overuse of maybe and [] in prelude and libs

Simon Peyton-Jones simonpj at microsoft.com
Thu Apr 8 18:41:21 EDT 2004


| > Haskell is pretty good about letting you install a different
Prelude, so you could try it yourself.
| 
| Hmm.  That's interesting!  How does this work?

It's very simple. Write your own Prelude as a Haskell module MyPrelude.

Then to use it, say
	module Foo where
	  import Prelude ()
	  import MyPrelude

(GHC lets you omit the 'import Prelude ()' by saying
-fno-implicit-prelude.)

No, there is no auto-magic; you are simply getting a different library,
that is all. And you have to write that library.

No problem with some modules using MyPrelude and some using Prelude.
(Any more than there's a problem when some modules import module A and
some import module B.)

Actually Haskell doesn't let you redefine *everything*, but GHC does:
read section 7.3.5 of the GHC manual
http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.htm
l#REBINDABLE-SYNTAX


Simon




More information about the Haskell mailing list