[Haskell-cafe] generalized list comprehensions

Max Bolingbroke batterseapower at hotmail.com
Sun Nov 9 05:15:01 EST 2008


2008/11/9 Johannes Waldmann <waldmann at imn.htwk-leipzig.de>:
> NB: Wasn't there a time (before "do") when "list" notation (brackets)
> would work in any monad? And "map" was a method in "Functor",
> and we had "class Functor m => Monad m", etc. Well well well times have
> changed.

Sure, I believe the feature was called "monad comprehensions". AFAIK
it was removed because it gave confusing error messages to new users
of the language (what is this Monad thing? I just want a list of
stuff!).

List comprehensions really have diverged from being a special "do"
notation at the list monad, since you are able to write comprehensions
like [(x, y) | x <- xs | y <- ys], and it's not clear how to define
"zip" for a monad - but perhaps there is some extension of a monad
where it makes sense?

All the best,
Max


More information about the Haskell-Cafe mailing list