Add instance Alternative (f :+: g)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Add instance Alternative (f :+: g)

Dannyu NDos
instance Alternative f => Alternative (f :+: g) where
    empty = InL empty
    InL x <|> InL y = InL (x <|> y)
    InL _ <|> y = y
    x <|> _ = x

This is analogous to the proposed Alternative Either instance.

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries