[Haskell-cafe] generalized list comprehensions
jonathanccast at fastmail.fm
Mon Nov 10 17:10:17 EST 2008
On Mon, 2008-11-10 at 16:06 -0600, Derek Elkins wrote:
> 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.
Well, the Cartesian product case is one way of an equivalence between
relations and sets of pairs. So I don't think it
[ (x, y) | x <- xn, y <- ys ]
is any more unusual than
[ x | x <- xn ]
More information about the Haskell-Cafe