FiniteMap: modifyFM

Simon Marlow
Thu, 20 Jun 2002 10:41:30 +0100

> > So...yeah...I've kind of lost my train of thought, but I think that
> > the problem I've frequently had is that I want to use the names the
> > prelude uses, but can't.  :).
> Back when Haskell 1.4 (or 98?) was being designed, I proposed that
> Haskell's rule that the Prelude is implicitly imported into every
> module should be dropped.  Benefit: simpler language, easier to
> replace Prelude with your own.  Cost: requires you to type 2 extra
> tokens in every module and to ask students to type it in without first
> giving them a full explanation of what it means.  Didn't get anywhere.
> I'm wondering if that would help at all?

So what's wrong with 'import Prelude()'?  If you regularly want to hide
certain names just define a module:

  module MyPrelude (module Prelude) where
  import Prelude hiding (map)

and at the top of every module in your own code, write

  import Prelude ()
  import MyPrelude

the current scheme is biased towards the majority (i.e. those that want
to use the Prelude unchanged), but it's flexible if you want to do
something else.  I think it's fine.