[Haskell-cafe] Eta-reducing case branches

Frank Staals frank at fstaals.net
Fri Apr 10 18:35:14 UTC 2015


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


More information about the Haskell-Cafe mailing list