Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2013-01-01 Thread Tillmann Rendel
Hi, Brandon Allbery wrote: [...] syntax extension [...] I think someone's already working on this (SugarHaskell?). Yes, we are working on it. See our paper [1] and Sebastian's talk [2] at the Haskell Symposium. Our current prototype can be installed as an Eclipse plugin [3] or as a

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-31 Thread adam vogt
On Sun, Dec 30, 2012 at 10:00 PM, Brandon Allbery allber...@gmail.com wrote: On Sun, Dec 30, 2012 at 8:42 PM, Dan Burton danburton.em...@gmail.com wrote: [featureX] is usually too powerful, it surely would be abused extensively, which would make developer's life a nightmare, unless there is

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread Petr P
Hi, I also support Jon's proposal for standalone of { ... }. Seems to me clearer and more useful than the special \case construct. I suppose 'of { ... }' could be generalized to multiple arguments, so that of (Just x) (Just y) - x ++ y would create an anonymous function of type 'Maybe String

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread David Thomas
Jon's suggestion sounds great. The bike shed should be green. That is all. On Sun, Dec 30, 2012 at 4:44 PM, Petr P petr@gmail.com wrote: Hi, I also support Jon's proposal for standalone of { ... }. Seems to me clearer and more useful than the special \case construct. I suppose 'of {

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread Chris Smith
On Sun, Dec 30, 2012 at 8:51 AM, David Thomas davidleotho...@gmail.comwrote: Jon's suggestion sounds great. The bike shed should be green. There were plenty of proposals that would work fine. `case of` was great. `\ of` was great. It's less obvious to me that stand-alone `of` is never

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread Dan Burton
My 2 cents on the issue: We should have a better forms of meta-programming to solve this sort of issue generally. With the power of first-class functions and laziness, we can get away with a lot of things without meta-programming, but case expression syntax is not first class, so cannot benefit

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread MigMit
Syntax extensibility is usually too powerful, it surely would be abused extensively, which would make developer's life a nightmare, unless there is only one developer and whole development takes no more than a couple of months. On Dec 31, 2012, at 1:09 AM, Dan Burton danburton.em...@gmail.com

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread Dan Burton
[featureX] is usually too powerful, it surely would be abused extensively, which would make developer's life a nightmare, unless there is only one developer and whole development takes no more than a couple of months. This doesn't say much about *why* syntax extension is too powerful, nor

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-30 Thread Brandon Allbery
On Sun, Dec 30, 2012 at 8:42 PM, Dan Burton danburton.em...@gmail.comwrote: [featureX] is usually too powerful, it surely would be abused extensively, which would make developer's life a nightmare, unless there is only one developer and whole development takes no more than a couple of months.

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-12-29 Thread Tom Ellis
On Thu, Nov 29, 2012 at 05:49:53PM +, Jon Fairbairn wrote: Ben Franksen ben.franksen at online.de writes: just wanted to drop by to say how much I like the new lambda case extension. I use it all the time and I just *love* how it relieves me from conjuring up dummy variables,

Re: [Haskell-cafe] lambda case

2012-12-01 Thread Roman Cheplyaka
It hasn't made it to the standard yet, though. If some experimental feature is implemented in GHC, it doesn't mean it's set in stone. I find this discussion useful — there are some interesting points (splitting case of into two parts) that I don't remember reading in the original thread (but

Re: [Haskell-cafe] lambda case

2012-12-01 Thread Brandon Allbery
On Sat, Dec 1, 2012 at 5:30 AM, Roman Cheplyaka r...@ro-che.info wrote: I find this discussion useful — there are some interesting points (splitting case of into two parts) that I don't remember reading in the original thread (but maybe it's just me). Mentioned twice that I recall, as

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Jon Fairbairn
Andreas Abel andreas.a...@ifi.lmu.de writes: I had been missing a pattern matching lambda in Haskell for a long time (SML had fn since ages) and my typical use will be monadic_expr = \case branches We’ve been through that. I want something similar, but would have preferred something

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Herbert Valerio Riedel
Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: [...] “\case” complicates lambda, using “of” simply breaks “case … of …” into two easily understood parts. Just some observation (I'm rather late to the lambda-case discussion, so this might have been already pointed out previously): if the

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Brent Yorgey
Oh, PLEASE people. Let's not have another round of bikeshedding about this AFTER the feature is already implemented! -Brent On Fri, Nov 30, 2012 at 01:25:27PM +0100, Herbert Valerio Riedel wrote: Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes: [...] “\case” complicates lambda, using

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Andreas Abel
Right, case..of is superfluous, case e of branches can now be written as e | \case branches with backwards application | (or some prefer --- sadly, the proposal to add backwards appliation to base did not make it to a consensus). This is in accordance to the monadic me =

[Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Jon Fairbairn
Ben Franksen ben.frank...@online.de writes: just wanted to drop by to say how much I like the new lambda case extension. I use it all the time and I just *love* how it relieves me from conjuring up dummy variables, which makes teh code not only esier to write but also to read. […] should

Re: [Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Andreas Abel
I had been missing a pattern matching lambda in Haskell for a long time (SML had fn since ages) and my typical use will be monadic_expr = \case branches I think \case is not the worst choice, certainly better than of ... Thanks to the GHC 7.6 developers! Cheers, Andreas On 29.11.12

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-06 Thread Matthew Gruen
On 10/2/10, Christopher Done chrisd...@googlemail.com wrote: On 2 October 2010 20:23, Max Bolingbroke batterseapo...@hotmail.com wrote: Do you like this feature and think it would be worth incorporating this into GHC? Or is it too specialised to be of use? If there is enough support, I'll

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Nicolas Wu
To repeat, the analogues in SML and Erlang *do* support multiple clauses (as well as pattern matching) and the failure of Haskell lambdas to do so has always seemed like a weird restriction in a language that's usually free of weird restrictions. I agree with this sentiment. I have never

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Neil Brown
On 05/10/10 07:52, Nicolas Wu wrote: I'd prefer to see something like \ 1 - f | 2 - g but I'm sure something could be worked out. While I think the case of is a good idea, multiple clauses in lambdas seems more canonical to me. Alternatively, we could abandon

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Nicolas Pouillard
On Tue, 5 Oct 2010 03:36:12 -0600, Luke Palmer lrpal...@gmail.com wrote: On Mon, Oct 4, 2010 at 9:04 PM, Dean Herington heringtonla...@mindspring.com wrote: With respect to datatype destructing functions, the Prelude has: maybe :: b - (a - b) - Maybe a - b either :: (a - c) - (b - c) -

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Gábor Lehel
I also vote +1 for lambda-case, and abstain for lambda-if. I don't think multiple-clause lambdas being desirable should be an argument against lambda-case. After all, we can also define top-level functions with either multiple clauses or a single case expression. Haskell has always followed the

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Ozgur Akgun
For what it's worth, after all this discussion my rather cheeky preference is as follows: Instead of introducing more specialised syntax, remove both existing special syntaxes for if and case, and introduce multi-clause support for lambdas! Cheers! On 2 October 2010 19:23, Max Bolingbroke

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Henning Thielemann
Richard O'Keefe schrieb: I'd prefer to see something like \ 1 - f | 2 - g but I'm sure something could be worked out. In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} ?

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/5/10 12:38 , Henning Thielemann wrote: In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} +1; likewise for consistency it should support guards (which would

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Ketil Malde
Donn Cave d...@avvanta.com writes: I think you're not the first to ask. Just out of curiosity, or is there a use for these variations? Just that they seem to be natural generalizations. If it's just the single form of paramtrizing the condition, I think it's better served by a regular

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Donn Cave
Quoth Ketil Malde ke...@malde.org, ... Just that they seem to be natural generalizations. If it's just the single form of paramtrizing the condition, I think it's better served by a regular function, 'bool' or (??) or whatever. Well, yes, there's some logic to that. Like, bool b c a = if a

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Max Bolingbroke
On 5 October 2010 17:38, Henning Thielemann schlepp...@henning-thielemann.de wrote: Richard O'Keefe schrieb: I'd prefer to see something like       \ 1 - f       | 2 - g but I'm sure something could be worked out. In order to be consistent with current case, maybe in layout mode: \1 - f

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Max Bolingbroke
On 4 October 2010 00:38, Conal Elliott co...@conal.net wrote: I like it! Are the other sections available as well, e.g.,     (if False then else Cafe) Haskell -- Cafe They are not, though this would certainly make sense for lambda-if. It's not so clear with lambda-case because of the issue

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Richard O'Keefe
On 6/10/2010, at 5:56 AM, Brandon S Allbery KF8NH wrote: In order to be consistent with current case, maybe in layout mode: \1 - f 2 - g and in non-layout mode \{1 - f; 2 - g} +1; likewise for consistency it should support guards (which would preclude using | the way Richard

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Evan Laforge
-1 for if then. The examples of curried if then else look, to my eyes, less readable than the pointed version. And it's easy enough to write a 'bool' deconstructor, or an 'ifM' for the monadic case. +1 for something to solve the dummy - m; case dummy of problem. Here are the possibilities I can

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-05 Thread Dean Herington Elizabeth Lacey
At 3:36 AM -0600 10/5/10, Luke Palmer wrote: On Mon, Oct 4, 2010 at 9:04 PM, Dean Herington heringtonla...@mindspring.com wrote: With respect to datatype destructing functions, the Prelude has: maybe :: b - (a - b) - Maybe a - b either :: (a - c) - (b - c) - Either a b - c which suggests

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Ketil Malde
Max Bolingbroke batterseapo...@hotmail.com writes: [1] http://hackage.haskell.org/trac/haskell-prime/ticket/41 I tried to find anything about lambda-if in there, but failed (Trac and I aren't on very friendly terms, so it's probably my fault). Is there more information about the rationale and

Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Bulat Ziganshin
Hello Ketil, Monday, October 4, 2010, 11:30:48 AM, you wrote: Prelude (if then Haskell else Cafe) False lambda-if is easily implemented in terms of usual functions. and we even have one named bool: bool: Bool - a - a - a lambda-case cannot be implemented as a function since we need matching

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Christopher Done
On 4 October 2010 10:55, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Ketil, Monday, October 4, 2010, 11:30:48 AM, you wrote: Prelude (if then Haskell else Cafe) False lambda-if is easily implemented in terms of usual functions. and we even have one named bool: bool: Bool - a -

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Donn Cave
Quoth Ketil Malde ke...@malde.org, Max Bolingbroke batterseapo...@hotmail.com writes: ... Prelude (if then Haskell else Cafe) False Cafe Presumably, this extends to Prelude (if False then else Cafe) Haskell Cafe and Prelude (if then Haskell else) False Cafe Cafe as well? I think

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Roel van Dijk
I really like the lambda-case. There are dozens of places in my code where I could use it. Not so sure about the lambda-if. It is just as easily done using an ordinary function. lambda-case: +1 lambda-if: neutral ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Richard O'Keefe
On 4/10/2010, at 8:30 PM, Ketil Malde wrote: Prelude (case of 1 - One; _ - Not-one) 1 One Prelude :q case of looks a bit weird, but I like the points brought up about avoiding to name a one-use variable (e.g., getArgs = case of ...) AFACS, this isn't easily implemented in Haskell

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Donn Cave
Quoth Richard O'Keefe o...@cs.otago.ac.nz, ... Erlang manages fine with multiclause 'fun': (fun (1) - One ; (_) - Not-one end)(1) ML manages fine with multiclause 'fn': (fn 1 = one | _ = not-one)(1) In both cases, the same notation is used for multiclause lambda as for single

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Richard O'Keefe
On 5/10/2010, at 12:49 PM, Donn Cave wrote: Just to be sure, are you saying, rather than case of 1 - f 2 - g you'd like to see \ support pattern matching etc. like named functions - \ 1 - f 2 - g Absolutely.For the record, lambda DOES support pattern

Re: Re[2]: [Haskell-cafe] Lambda-case / lambda-if

2010-10-04 Thread Dean Herington
At 12:05 PM +0200 10/4/10, Christopher Done wrote: On 4 October 2010 10:55, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Ketil, Monday, October 4, 2010, 11:30:48 AM, you wrote: Prelude (if then Haskell else Cafe) False lambda-if is easily implemented in terms of usual

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-03 Thread Conal Elliott
I like it! Are the other sections available as well, e.g., (if False then else Cafe) Haskell -- Cafe - Conal On Sat, Oct 2, 2010 at 11:23 AM, Max Bolingbroke batterseapo...@hotmail.com wrote: Hi Cafe, I implemented the proposed Haskell' feature lambda-case/lambda-if [1] during the

[Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Max Bolingbroke
Hi Cafe, I implemented the proposed Haskell' feature lambda-case/lambda-if [1] during the Haskell Implementors Workshop yesterday for a bit of fun. The patches are online [2, 3]. The feature is demonstrated in this GHCi session: $ inplace/bin/ghc-stage2 --interactive -XLambdaCase GHCi, version

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Colin Paul Adams
Max == Max Bolingbroke batterseapo...@hotmail.com writes: Prelude (if then Haskell else Cafe) False Max Cafe My reaction is to ask: Can you write this as: (if then else) False Haskell Cafe ? -- Colin Adams Preston Lancashire () ascii ribbon campaign - against html e-mail /\

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Henning Thielemann
On Sat, 2 Oct 2010, Max Bolingbroke wrote: Hi Cafe, I implemented the proposed Haskell' feature lambda-case/lambda-if [1] during the Haskell Implementors Workshop yesterday for a bit of fun. The patches are online [2, 3]. The feature is demonstrated in this GHCi session: $

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Henning Thielemann
On Sat, 2 Oct 2010, Colin Paul Adams wrote: Max == Max Bolingbroke batterseapo...@hotmail.com writes: Prelude (if then Haskell else Cafe) False Max Cafe My reaction is to ask: Can you write this as: (if then else) False Haskell Cafe ? Sure: ifThenElse :: Bool - a - a - a

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Christopher Done
On 2 October 2010 20:23, Max Bolingbroke batterseapo...@hotmail.com wrote: Do you like this feature and think it would be worth incorporating this into GHC? Or is it too specialised to be of use? If there is enough support, I'll create a ticket and see what GHC HQ make of it. Nice work! I like

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Christopher Done
I just had a look at hpaste.org, and, amusingly, the first paste has this: down - openLazyURI http://list.iblocklist.com/?list=bt_level1; case down of Left _ - error Could not download file Right bs - do input - bs ... I can

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Ozgur Akgun
On 2 October 2010 19:33, Henning Thielemann lemm...@henning-thielemann.dewrote: On Sat, 2 Oct 2010, Max Bolingbroke wrote: ... lambda-case/lambda-if ... Nice! Concerning if-then-else I would more like to see an according function to go to Data.Bool, then we won't need more syntactic sugar

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Jan Christiansen
On 02.10.2010, at 20:35, Henning Thielemann wrote: On Sat, 2 Oct 2010, Colin Paul Adams wrote: Prelude (if then Haskell else Cafe) False Max Cafe My reaction is to ask: Can you write this as: (if then else) False Haskell Cafe ? Sure: ifThenElse :: Bool - a - a - a ifThenElse

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Felipe Lessa
On Sat, Oct 2, 2010 at 4:13 PM, Christopher Done chrisd...@googlemail.com wrote: There's nothing more annoying than having to introduce intermediate bindings when you're going to immediate pattern match against it immediately and never use it again. It's both annoying to have to think of a

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/2/10 15:27 , Jan Christiansen wrote: You can use a similar approach for case expressions ; ) There are several better (that is, not using unsafePerformIO) versions at http://haskell.org/haskellwiki/Case . - -- brandon s. allbery

Re: [Haskell-cafe] Lambda-case / lambda-if

2010-10-02 Thread wren ng thornton
On 10/2/10 3:13 PM, Christopher Done wrote: There's nothing more annoying than having to introduce intermediate bindings when you're going to immediate pattern match against it immediately and never use it again. It's both annoying to have to think of a variable name that makes sense and is not