[Haskell-cafe] Eta-reducing case branches

Erik de Castro Lopo mle+hs at mega-nerd.com
Sat Apr 11 08:22:22 UTC 2015


Tom Ellis wrote:

> Likewise, I have often wanted to rewrite
> 
>     case m of
>         Nothing -> n
>         Just x  -> quux x

Why not emply the maybe function (b -> (a -> b) -> Maybe a -> b)

     maybe n quux m

Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/


More information about the Haskell-Cafe mailing list