FiniteMap: modifyFM

Alastair Reid
20 Jun 2002 12:42:48 +0100

> So what's wrong with 'import Prelude()'?  

It's kinda cryptic.  A reasonable way to describe the rule being
followed when you write 'import Prelude()' is:

  "To not import the prelude, first import the Prelude."

It has to be explained to people as a special rule.  After all, if I
see this:

  import Foo()

I know I can delete it with no change to the program.  Do that with an
import Prelude and you probably get a warnign about ambiguous imports.
So it's another rule you have to explain to people.

The situation where this came up was in writing Embedded Domain
Specific Langauges like Fran.  Fran users didn't want to know about
Haskell's module system.  It seemed reasonable to ask them to write

  import Fran

at the head of their program but asking them to not import something
they've never heard of using cryptic syntax seems a bit much.

Similarily, if teaching functional programming, one might want to
start out with a beginners' Prelude which has no type classes, only
Integer (or Rational?), omits foldl, map and friends (because you want
to teach students how to write their own versions, etc.)  First thing
you have to do is explain something cryptic.  "Well, see there's this
thing called a Prelude which we're not going to discuss in this course
and we don't want it so what we do is we import it to make it go away."

Alastair Reid