Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Duncan Coutts
On Sun, 2009-07-19 at 23:07 +0100, Thomas Schilling wrote: 2009/7/19 Max Bolingbroke batterseapo...@hotmail.com Dear Cafe, For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen: [k, =, v, | (k, v) - [(foo, 1), (bar,

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Neil Mitchell
Except that it's ugly compared to the proposed extension. With the extension you can put things in the same, right place: renderGhcOptions opts =     ghcOptExtraPre opts  -- source search path  ++ [ -i      | not (null (ghcOptSearchPath opts)) ]  ++ [ -i, dir | dir - ghcOptSearchPath opts

Re[2]: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Bulat Ziganshin
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

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Thomas Schilling
I'm not convinced ugly is a good reason to add more complexity to the language syntax. I am not aware of a good metric to measure the costs/beneficts of new syntactic constructs. Part of the costs are the number of tools that need to be adapted and the extend of their loss of utility if they are

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Dan Weston
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

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-21 Thread Felipe Lessa
On Tue, Jul 21, 2009 at 12:29:18PM -0700, Dan Weston wrote: 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? Please, please, do not allow that. People wanting [] should write []. Thanks! --

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Roel van Dijk
I think the tuple sections are a great idea! It also makes tuple types and constructors more alike: x :: (,) String Double x = (,) Pi 3.14159 I can also see some uses in writing pointfree code. I would definitely want this in a future GHC (or any other Haskell compiler/interpreter) release. I'm

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Roel van Dijk
On Mon, Jul 20, 2009 at 1:27 PM, Roel van Dijkvandijk.r...@gmail.com wrote: I think the tuple sections are a great idea! It also makes tuple types and constructors more alike: x :: (,) String Double x = (,) Pi 3.14159 I just realised this is already in GHC :-) But does you patch also add the

RE: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Sittampalam, Ganesh
Roel van Dijk wrote: On Mon, Jul 20, 2009 at 1:27 PM, Roel van Dijkvandijk.r...@gmail.com wrote: I think the tuple sections are a great idea! It also makes tuple types and constructors more alike: x :: (,) String Double x = (,) Pi 3.14159 I just realised this is already in GHC :-) But

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Roel van Dijk
I am also wondering what the following would/should mean:   (1, , ( , 2), ) 'a' 'b' 'c' I would expect it to be a type error, since I think the following is the only sane type the tuple can have (assuming numeric literals :: Int): (1, , ( , 2), ) :: a - b - (Int, a, c - (c, Int), b)

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Max Bolingbroke
2009/7/20 Roel van Dijk vandijk.r...@gmail.com: I just realised this is already in GHC :-) But does you patch also add the equivalent for tuple type annotations? x :: (String, ) Double x = (Pi, ) 3.14159 It doesn't, and indeed it would only work in the special case where your only missing

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread Nicolas Pouillard
Excerpts from Max Bolingbroke's message of Sun Jul 19 16:58:08 +0200 2009: Dear Cafe, For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen: [...] P.S. I also implemented tuple sections

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-20 Thread porges
2009/7/21 Roel van Dijk vandijk.r...@gmail.com: I am also wondering what the following would/should mean:   (1, , ( , 2), ) 'a' 'b' 'c' I would expect it to be a type error, since I think the following is the only sane type the tuple can have (assuming numeric literals :: Int): (1, , ( , 2),

[Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-19 Thread Max Bolingbroke
Dear Cafe, For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen: [k, =, v, | (k, v) - [(foo, 1), (bar, 2)] [foo, =, 1, , bar, =, 2, ] This is a generalisation of list comprehensions that allows several items to be concatenated

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-19 Thread Neil Mitchell
Hi Max, For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen: [k, =, v, | (k, v) - [(foo, 1), (bar, 2)] [foo, =, 1, , bar, =, 2, ] This is a generalisation of list comprehensions that allows several items to be

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-19 Thread Thomas Hartman
I vote for tuple sections. Very nice! I don't really see immediate places where I would use the list comprehension improvement so I guess I don't vote for that. 2009/7/19 Neil Mitchell ndmitch...@gmail.com: Hi Max, For fun, I spent a few hours yesterday implement support for this syntax in

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-19 Thread Robin Green
I really like tuple sections and I've wanted them for years. I never use comprehensions though, so I abstain from the other vote. -- Robin On Sun, 19 Jul 2009 08:18:48 -0700 Thomas Hartman tphya...@gmail.com wrote: I vote for tuple sections. Very nice! I don't really see immediate places

Re: [Haskell-cafe] Implicit concatenation in list comprehensions

2009-07-19 Thread Thomas Schilling
2009/7/19 Max Bolingbroke batterseapo...@hotmail.com Dear Cafe, For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen: [k, =, v, | (k, v) - [(foo, 1), (bar, 2)] [foo, =, 1, , bar, =, 2, ] Given that this can easily be