[Haskell-cafe] Why Maybe exists if there is Either?

Brandon Allbery allbery.b at gmail.com
Thu Jan 9 17:16:08 UTC 2014


On Thu, Jan 9, 2014 at 12:11 PM, Ben Foppa <benjamin.foppa at gmail.com> wrote:

> Aside from the point made about typeclass instances, I don't see an issue
> with:
>
> type Maybe = Either ()
>
> nothing :: Maybe a
> nothing = Left ()
>
> just :: a -> Maybe a
> just = Right
>
Not until you try to pattern match on it....

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140109/242e4156/attachment.html>


More information about the Haskell-Cafe mailing list