List comprehensions

Ross Paterson ross@soi.city.ac.uk
Thu, 30 Jan 2003 11:08:13 +0000


On Thu, Jan 30, 2003 at 11:41:49AM +0100, Rijk J. C. van Haaften wrote:
> Recently, I came accross this
> expression:
> [ x + y | x <- xs | y <- ys ]
> 
> As far as I can see (Haskell Report),
> this is not allowed by the haskell 98
> standard. So I assume it to be an ex-
> tension. Where can I find information
> about this?

It's not Haskell 98, but is implemented in GHC and Hugs (with extensions
turned on).  It's a "parallel list comprehension", and is equivalent to

	zipWith (+) xs ys

See the GHC User's Guide for more.