replacing the Prelude (again)

Simon Peyton-Jones simonpj@microsoft.com
Mon, 15 Jul 2002 09:05:01 +0100


I'm fond of the idea proposed by Marcin 'Qrczak' Kowalczyk:

|   May I propose an alternative way of specifying an alternative
Prelude?
|   Instead of having a command line switch, let's say that 3 always
means
|   Prelude.fromInteger 3 - for any *module Prelude* which is in scope!

That's a perfectly reasonable idea, but GHC can't make it the default
because
it's not H98.  It *would* be possible to make GHC's
-fno-implicit-prelude flag
mean that=20
	3 	means 	Prelude.fromInteger 3
		rather than	fromInteger 3

I quite like the fact that you would then have to say=20

       import MyPrelude as Prelude

thereby stressing that you are importing the Prelude stuff.  But it
would be
that *plus* -fno-implicit-prelude, I'm afraid.  If there were a
consensus in
favour of this I'll gladly do it (5 min job).


| anymore. What I would like is that the defualting rules refer=20
| to the classes in my version of the Prelude,=20
| not the Standard Prelude.

You can always get that (with the -fno-implicit-prelude thing) by adding

	default [Int, Double]

or whatever to your source module, just after the import that gets your
new standard Prelude.  Doesn't that do it? =20

It would also not be hard to arrange that the "default default"
declaration
became scoped with -fno-implicit-prelude (like fromInteger), if=20
that was useful.   It's a good point; I thought that *all* the numeric
stuff
was un-coupled from the Prelude with -fno-implicit-prelude, but it isn't
quite.

Simon