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

Conal Elliott conal at conal.net
Sun Jan 13 18:46:14 EST 2008


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 <ndmitchell at gmail.com> 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 to:
>
> f [] = [1]
> f x = (sort . nub) x
>
> i.e. lift the arities to the longest argument list.
>
> Is there a reason this isn't done?
>
> Thanks
>
> Neil
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080113/02537de9/attachment.htm


More information about the Haskell-Cafe mailing list