Non-H98 crusade, contd.

Andrew Pimlott andrew at
Mon Feb 28 14:23:38 EST 2005

On Mon, Feb 28, 2005 at 06:47:05PM +0000, Malcolm Wallace wrote:
> Andrew Pimlott <andrew at> writes:
> > On Mon, Feb 28, 2005 at 01:45:25PM +0000, Malcolm Wallace wrote:
> > > As examples of language features that should be removed or revised,
> > > how about these:
> > 
> > Perhaps
> > 
> >     (d) the restriction of list comprehension to lists (instead of
> >         MonadPlus)
> You do realise that we used to have monad comprehensions in Haskell
> 1.4, and they were deliberately removed for Haskell'98?

Yes, I heard this.

> The reason
> was that error messages for beginners' code were rather baffling.
> (And pretty baffling for some experts too!)

I don't understand how they could be more baffling than any other type
errors involving monads.  Can you give an example?  (I could not find
any, only mentions of them.)  Maybe error messages were less clear then?
Or maybe understanding of monads was less pervasive?

The only reason I can think of is psychological:  List comprehensions
look like lists, so one might not expect any other type to be
considered.  This is a weak reason in my opinion.

For my part, I was initially baffled (and then sharply disappointed)
when my Maybe comprehension wouldn't compile.

> In any case, the
> do notation is exactly analogous to list comprehensions with the
> restriction to a single monad lifted.

Sure, but if list comprehension syntax is sometimes better for lists, it
is sometimes better for other MonadPlus instances.  Having two "exactly
analogous" constructs in the language, but putting an arbitrary
restriction on one, seems in poor taste.


More information about the Libraries mailing list