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:
parent
4deabf496f
commit
63802d3137
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user