[Haskell-cafe] Why the Prelude must die

David Menendez zednenem at psualum.com
Sat Mar 24 22:50:45 EDT 2007


Chris Eidhof writes:

> 
> On Mar 24, 2007, at 2:36 AM, Sebastian Sylvan wrote:
> 
> >
> > The solution is simple:
> >
> > * If there is a "module M where" clause in the beginning of the
> > file, then it's a "proper" module and shouldn't import the Prelude.
> > * If there is no module declaration then it's a "quick'n dirty
> > script" and should have the Prelude implicitly imported.
> > * Interactive interpreters should probably import the Prelude.

> So if I'm writing a script, which has been working, then import  
> Control.Monad, it all suddenly stops working?

No, that's an import declaration, not a module declaration.

So far, this is my favorite proposal, but I'm not sure it's better than
leaving things the way they are. There's a lot of useful stuff in the
Prelude, so the typical usage is likely to be "import Prelude hiding
(...)", which you can do right now.

On the other hand, making this like this explicit seems consistent with
Haskell's traditions.
-- 
David Menendez <zednenem at psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"


More information about the Libraries mailing list