replacing the Prelude (again)

Bernard James POPE
Sat, 13 Jul 2002 19:58:19 +1000 (EST)

Hi all,

Sorry to dig up an old topic, but I think this is an important one.
(at least it is for me).

I have run into a problem recently. I am writing a debugger for Haskell.
It is based on a source-to-source transformation. The important bit is that
the type of functions changes under the transformation. If you want to
debug calls into the Standard Prelude (yes this is useful) then a transformed
Prelude must be used. The idea being that a transformed program imports a
transformed Prelude. That's okay, my debugger can transform all of the
Standard Prelude since it is just a Haskell module 
(with provisions for primitive functions of course). The problem is that
when I replace the Standard Prelude with a transformed Prelude
the defaulting mechanism doesn't work anymore. What I would like is that
the defualting rules refer to the classes in my version of the Prelude, 
not the Standard Prelude.

I am using ghc version 5.03, and I don't think -fno-implicit-prelude
can help here. I do think that this issue is independent of the 
Haskell environment, and more an issue of the design of the language.

Now there have already been some discussions about replacing the
Standard Prelude with a non-Standard Prelude. The trick being that
a fair degree of the language definition makes use of things in the
Standard Prelude.

See for example:

   Dylan Thurston Replacing the Prelude

   Primitive types and Prelude shenanigans

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 is, one could say:
       import Prelude ()
       import MyPrelude as Prelude
   IMHO it's very intuitive, contrary to -fno-implicit-prelude flag.

Presuming of course that defaulting would follow this path and refer to the new

I'm wondering if any further progress has been made towards this? Or perhaps
someone can think of a temporary solution to my problem?