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

Neil Mitchell ndmitchell at gmail.com
Sun Jan 13 20:21:47 EST 2008

Hi Conal,

On 1/13/08, Conal Elliott <conal at conal.net> 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. It's highly misleading.

Again, I don't believe that. Your argument holds for why we shouldn't
have multiple equations for definition, not that they should all be
the same arity.

>  Offhand, I don't know of
> a desugaring that would do the trick and preserve sharing.  Any ideas?  -

> f = let body = sort . nub
>         in \xs -> case xs of
>             [] -> [1]
>             (_:_) -> body

Compared to other desugarings in Haskell, this one is positively tame!
 I quite like the idea of permitting equations to have different
arities. It removes restrictions, makes things more regular etc.



More information about the Haskell-Cafe mailing list