[Haskell-cafe] Eta-reducing case branches

Christopher Done chrisdone at gmail.com
Fri Apr 10 18:54:23 UTC 2015


Well, I think his proposal was that for a constructor C with n slots, the
RHS of the case alt would be expected to be an n-ary function where arg*i*
for *i..n* would have type T*i* for the types of each slot in C. I think it
adds up logically... but it is rather odd.

On 10 April 2015 at 20:35, Frank Staals <frank at fstaals.net> wrote:

> Tom Ellis <tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> writes:
>
> > Has anyone ever considered permitting case branches to be eta reduced?
> For
> > example, it is often nice to rewrite
> >
> >     foo x = bar baz x
> >
> > as
> >
> >     foo = bar baz
> >
> > Likewise, I have often wanted to rewrite
> >
> >     case m of
> >         Nothing -> n
> >         Just x  -> quux x
> >
> > as
> >     case m of
> >         Nothing -> n
> >         Just    -> quux
> >
> > Am I missing an obvious reason this wouldn't work?
> >
> > Tom
>
> I would think that is a bit weird since Nothing and Just have different
> types.
>
> --
>
> - Frank
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150410/214f33e6/attachment.html>


More information about the Haskell-Cafe mailing list