Replacing the Prelude

Simon Peyton-Jones simonpj@microsoft.com
Tue, 14 May 2002 07:17:38 -0700


Ashley writes

| > I was hoping to do something similar for 'do' notation by redefining
| > (>>), (>>=3D) etc., but unfortunately GHC is quite insistent=20
| that 'do' notation quite specifically refers to GHC.Base.Monad=20

Dylan replies

| I'm surprised that ghc uses the fromInteger and fromRational=20
| that are in scope; I thought there was general agreement that=20
| it should use the Prelude.from{Integer,Rational} in scope.

Ashley is referring to a GHC extension.  Normally, GHC uses
Prelude.fromInteger etc, regardless of what is in scope.  But if you
say -fno-implicit-prelude, GHC will instead use whatver fromInteger
is in scope.  (This is documented in the manual.)

Ashley's question, as I understand is whether something similar
could be done for monads.=20

Answer: I think so, without much bother.   I'm beavering away on
a Haskell workshop paper at the moment, but ping me in a fortnight
to do it.

Simon