Add instance Alternative (Either e)

Dannyu NDos ndospark320 at gmail.com
Tue Aug 6 19:40:09 UTC 2019


instance Monoid e => Alternative (Either e) where
    empty = left mempty
    Left x <|> Left y = Left (x <> y)
    Left _ <|> y = y
    x <|> _ = x

Leftmost Right is returned for sake of consistence with Semigroup instance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190807/44f1ab43/attachment.html>


More information about the Libraries mailing list