[Haskell-cafe] Implicit concatenation in list comprehensions
Dan Weston
westondan at imageworks.com
Tue Jul 21 15:29:18 EDT 2009
Bulat Ziganshin wrote:
> Hello Neil,
>
> Tuesday, July 21, 2009, 1:26:55 PM, you wrote:
>
>>> ++ [ "-i" | not (null (ghcOptSearchPath opts)) ]
>>> ++ [ "-i", dir | dir <- ghcOptSearchPath opts ]
>
>> Following the discussions, I now support this extension too - I keep
>> seeing more and more places in my code where it would be very useful.
>
>>> ++ [ "-i" | not (null (ghcOptSearchPath opts)) ]
>>> ++ concat [ ["-i", dir] | dir <- ghcOptSearchPath opts ]
[a | c ] = concat $ do { c; return [a] }
[a,b | c ] = concat $ do { c; return [a,b] }
This would mean that
[ | c ] = concat $ do { c; return [] }
The right is legal Haskell and gives []. The left is (not yet) legal.
Should it be?
Dan
More information about the Haskell-Cafe
mailing list