monad parsing article....

David Feuer [email protected]
Wed, 23 Jan 2002 16:35:09 -0500 (EST)


>        Also, why were monad comprehensions
>        removed from Haskell?  Was it for efficiency?
>
> No, it was to help beginners. When list comprehensions, and other list
> operators like ++ and filter were overloaded, then errors involving the
> class
> system became much more common, and in particular cropped up for simple
> list

I now understand the problem.  However, I'm not sure that the solution is
the right one.  I think that it makes more sense to change the way that
Haskell deals with the Prelude.  I think the way this issue is handled in
DrScheme (www.plt-scheme.org) is pretty reasonable.  There are a number of
different "language levels" available.  In the beginner's mode,
complex operations are prohibited, and (I think) some operations have
restricted semantics.  It would seem to make sense for Haskell
implementations to provide something similar: a prelude customized for
beginners would have no overloaded functions, a prelude for experts would
have many of them.  Special syntactic forms like comprehensions and do
notation can be specialized to the language mode.  Examples for beginner's
mode:

monad comprehensions become list comprehensions
do notation is restricted to IO
numbers are not overloaded: 4,5,6::Integer and 4.0,5.0,6.0::Float

This kind of multi-level system would allow beginner's an easy
introduction without forcing people who know what they're doing to
remember bizarre names for simple overloaded operators.

David Feuer