1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Maybe is a PartialSemigroup under a Monoid.

This commit is contained in:
Rob Rix 2016-03-05 01:00:11 -05:00
parent 4deabf496f
commit 63802d3137

View File

@ -32,3 +32,8 @@ instance PartialSemigroup a => Monoid (Adjoined a) where
instance PartialSemigroup Bool where
coalesce True = Just
coalesce False = const Nothing
instance Monoid a => PartialSemigroup (Maybe a) where
coalesce Nothing _ = Nothing
coalesce _ Nothing = Nothing
coalesce (Just a) (Just b) = Just (Just (a `mappend` b))