Haskell 98 Report possible errors, part one

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
23 Jul 2001 14:43:21 GMT

Mon, 23 Jul 2001 15:11:32 +0100, Olaf Chitil <olaf@cs.york.ac.uk> pisze:

> Both don't allow a simple translation of Haskell into the Haskell
> kernel,
> e.g. you cannot translate [1..] into Prelude.enumFrom 1, because the
> latter may be ambiguous.

That's why I was proposing that importing another module as Prelude
should be the way to change the meaning of builtin syntax in ghc,
instead of -fno-implicit-prelude combined with importing some names
to be available unqualified.

It's not a change in the report, which doesn't support changing the
meaning of builtin syntax and should only be clarified that entities
refer to standard Prelude. But as an extension some builtin syntax in
ghc might be defined as textual expansion to Prelude-qualified names,
so they may come either from original Prelude or from a replacement.

To complete that extension it should be legal to self-import:
    module MyPrelude where
    import MyPrelude as Prelude
    import Prelude as P
so that 5 used in this very module expands to Prelude.fromIntegral 5,
i.e. MyPrelude.fromIntegral 5.

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZASTĘPCZA