[Haskell-cafe] generalized list comprehensions

Derek Elkins derek.a.elkins at gmail.com
Mon Nov 10 17:06:29 EST 2008

On Mon, 2008-11-10 at 18:50 +0000, Duncan Coutts wrote:
> If you meant, why is it allowed rather than banned then I guess the
> answer is because it is orthogonal. The rules naturally handle that case
> and there was no particular reason to ban it, even if it is somewhat
> unusual.

"Unusual?"  This is the motivation of list comprehensions.

In naive set theory, set comprehensions are one way of an equivalence
between predicates and sets.  It's the Cartesian product aspect that
should be considered unusual if anything.  The binding aspect of list
generators corresponds to naming the parameters of the predicate and
then the Cartesian product aspect is simply the fact that a binary
predicate, say, is a unary predicate on a binary Cartesian product.

More information about the Haskell-Cafe mailing list