
Hello, 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? Thanks, Rijk

* Rijk J. C. van Haaften
Recently, I came accross this expression: [ x + y | x <- xs | y <- ys ] ^ Put a comma ',' here.
Regards, Olli -- obraun@ -+-[ informatik.unibw-muenchen.de ]-+-[ IIS _ INF _ UniBwM ] |-[ FreeBSD.org ]-+-[ FreeBSD Commmitter ] |-[ unsane.org ]-+-[ everything __ else ]

* Rijk J. C. van Haaften
[2003-01-30 11:41 +0100]: Recently, I came accross this expression: [ x + y | x <- xs | y <- ys ] ^ Put a comma ',' here.
That's something totally different. Two examples: 1. Comma [ x + y | x <- [1,2], y <- [3,4] ] = [4,5,5,6] 2. Bar [ x + y | x <- [1,2] | y <- [3,4] ] = [ x + y | (x,y) <- zip [1,2] [3,4] ] = zipWith (+) [1,2] [3,4] = [4,6] The first is according to the standard. No problems so far. However, I couldn't find a description of the semantics of the second (and it is clearly non-standard), though I think the semantics given above using zip and zipWith are correct. Rijk

* Rijk J. C. van Haaften
* Rijk J. C. van Haaften
[2003-01-30 11:41 +0100]: Recently, I came accross this expression: [ x + y | x <- xs | y <- ys ] ^ Put a comma ',' here.
That's something totally different. Two examples: 1. Comma [ x + y | x <- [1,2], y <- [3,4] ] = [4,5,5,6]
2. Bar [ x + y | x <- [1,2] | y <- [3,4] ] = [ x + y | (x,y) <- zip [1,2] [3,4] ] = zipWith (+) [1,2] [3,4] = [4,6]
The first is according to the standard. No problems so far. However, I couldn't find a description of the semantics of the second (and it is clearly non-standard), though I think the semantics given above using zip and zipWith are correct.
Ok, I see. Sorry, this was just my first thought. Unfortunately I cannot help you with the Bar thing. Regards, Olli -- obraun@ -+-[ informatik.unibw-muenchen.de ]-+-[ IIS _ INF _ UniBwM ] |-[ FreeBSD.org ]-+-[ FreeBSD Commmitter ] |-[ unsane.org ]-+-[ everything __ else ]

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.

On 2003-01-30 at 11:08GMT Ross Paterson wrote:
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).
As far as I can tell ghc 5.04 accepts this without complaint. Is this a bug, or should I pass some argument to turn extensions off? Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk

tor 2003-01-30 klockan 11.41 skrev Rijk J. C. van Haaften:
Hello,
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?
This is an extension present in the GHC compiler: http://www.haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#PA... Regards, Martin -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B
participants (5)
-
Jon Fairbairn
-
Martin Norbäck
-
Oliver Braun
-
Rijk J. C. van Haaften
-
Ross Paterson