Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-28 Thread Malcolm Wallace
David House [EMAIL PROTECTED] wrote: Or perhaps (?:) or something like that, This has come up a few times on #haskell, and the consensus is that a tertiary (?:) operator isn't possible because of the deep specialness of (:). However, you can simulate it pretty well: infixr 1 ? (?) ::

[Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Niklas Broberg
I would be happy to write up a trac-ticket for this - I could even try to implement it in GHC. However, I'm surprised that you agree with it so easily since it breaks some Haskell 98-ish stuff in un-nice ways. :-) First of all, programs that import names from the Prelude explicitly would no

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Doaitse Swierstra
On Jul 27, 2006, at 1:35 PM, Niklas Broberg wrote: I would really like to see this implemented, and I don't think the above is serious enough that we shouldn't. There may be some that don't agree though. Speak up now, or forever hold your peace! Given the ever increasing complexity of

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Niklas Broberg
On 7/27/06, Doaitse Swierstra [EMAIL PROTECTED] wrote: Given the ever increasing complexity of Haskell as understood by the GHC, I think very few people are looking forward to see further complications that do not really add much. We alreday are at a stage where first year students trying to

RE: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Simon Peyton-Jones
| We alreday are at a stage where first year students trying to master | haskell get error messages like | | Bool is not an instance of the class Num | | if they accidently write 1 + True (or something equivalent, but less | obvious). | | If you want to mess around why not call the function

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Paul Hudak
I'm all for making Haskell easy for beginners, but as Simon points out, this change shouldn't really affect them. Since I'm also a fan of using Haskell as the host for embedded DSL's, I think this would be a good addition, since it provides more flexibility with the syntax. -Paul Simon

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread David Roundy
On Thu, Jul 27, 2006 at 02:57:20PM +0200, Doaitse Swierstra wrote: On Jul 27, 2006, at 1:35 PM, Niklas Broberg wrote: I would really like to see this implemented, and I don't think the above is serious enough that we shouldn't. There may be some that don't agree though. Speak up now, or

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread David House
(Apologies to Niklas for multiple copies, it was a Reply/Reply to all mixup.) On 27/07/06, Niklas Broberg [EMAIL PROTECTED] wrote: First of all, programs that import names from the Prelude explicitly would no longer be able to use if-then-else unless they also added 'cond' to that input list

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread David House
On 27/07/06, David Roundy [EMAIL PROTECTED] wrote: Or perhaps (?:) or something like that, which could be used infix to evoke the idea of C's e1 ? e2 : e3 syntax. provided to me is less clear than cond since it has other meanings, and isn't borrowed from any language that I'm familiar with,

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Niklas Broberg
On 7/27/06, David House [EMAIL PROTECTED] wrote: How about we drop the idea of an auxilary cond function, and instead just use a Boolean typeclass? class Boolean b where isTrue :: b - Bool isFalse :: b - Bool Then the semantics of if-then-else would change to something like this: if b then

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Brandon Moore
David House wrote: How about we drop the idea of an auxilary cond function, and instead just use a Boolean typeclass? class Boolean b where isTrue :: b - Bool isFalse :: b - Bool I don't think this covers embedded languages. If everything lives in some monad it might be useful to rebind the