Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-14 Thread Lennart Augustsson
There is no technical reason for this. It's a matter of taste. As someone else pointed out, different arities is usually a bug. -- Lennart On Jan 13, 2008 3:12 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub But

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-14 Thread Bulat Ziganshin
Hello Neil, Monday, January 14, 2008, 2:12:52 AM, you wrote: But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub Is there a reason this isn't done? this may be also due an error, and in most cases it actually will be due an error. then it makes type

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Conal Elliott
That eta-expansion desugaring would lose sharing. Offhand, I don't know of a desugaring that would do the trick and preserve sharing. Any ideas? - Conal On Jan 13, 2008 3:12 PM, Neil Mitchell [EMAIL PROTECTED] wrote: Hi, It's nice to write functions in point free style: f = sort . nub

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Neil Mitchell [EMAIL PROTECTED]: It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. I

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Conal Elliott [EMAIL PROTECTED]: That eta-expansion desugaring would lose sharing. Offhand, I don't know of a desugaring that would do the trick and preserve sharing. Any ideas? How about this? f = let body = sort . nub in \xs - case xs of [] - [1]

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Neil Mitchell
Hi Conal, On 1/13/08, Conal Elliott [EMAIL PROTECTED] wrote: That eta-expansion desugaring would lose sharing. Ah, that will be it. 1. Equations with different arities more often signal bugs than correct intentions. I don't believe that. I suspect the type system will mop these up. 2.

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread jerzy . karczmarczuk
Neil Mitchell writes: I quite like the idea of permitting equations to have different arities. It removes restrictions, makes things more regular etc. More regular??? My goodness... Of course, it removes restrictions. But in the history of humanity rarely the removal of restrictions made

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Jonathan Cast
On 13 Jan 2008, at 5:38 PM, [EMAIL PROTECTED] wrote: Neil Mitchell writes: I quite like the idea of permitting equations to have different arities. It removes restrictions, makes things more regular etc. More regular??? My goodness... Of course, it removes restrictions. But in the history

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread Roman Leshchinskiy
Neil Mitchell wrote: Hi, It's nice to write functions in point free style: f = sort . nub But sometimes I have to add an extra case, on a certain value: f [] = [1] f = sort . nub But now these equations have different arities, and its rejected by Haskell. Why does this not simply desugar

Re: [Haskell-cafe] All equations must have the same arity - why?

2008-01-13 Thread ajb
G'day all. Quoting Neil Mitchell [EMAIL PROTECTED]: I don't believe that. I suspect the type system will mop these up. As previously noted, anything involving undefined (thanks to seq) is not equivalent. While undefined is arguably uncommon, error most certainly isn't: f1 (x:xs) = {-