#3380: [Patch] Support implicit concatenation in list comprehensions
-----------------------------+----------------------------------------------
Reporter:  batterseapower    |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  6.10.4            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 Using the -XImplicitConcatListComp option turns on implicit
 concatenation in list comprehensions. What this means is that you can
 write several things separated by commas in the "body" of a list
 comprehension, like so

 {{{
 [x, x | x <- [1..10], x `mod` 2 == 0]
 }}}

 This program produces the following output

 {{{
 [2, 2, 4, 4, 6, 6, 8, 8]
 }}}

 The effect is the same as if you had written

 {{{
 concat [[x, x] | x &lt;- [1..10], x `mod` 2 == 0]
 }}}

 but more concise, and more likely to be optimised well by the compiler.

 NB: this was originally proposed in the SQL-like list comprehensions
 paper.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3380>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to