mirror of
https://github.com/github/semantic.git
synced 2024-12-23 23:11:50 +03:00
Define a Monoid instance for Map.
This commit is contained in:
parent
303e55b403
commit
f199e7fa73
@ -10,3 +10,7 @@ newtype Map key value = Map { unMap :: Map.Map key value }
|
|||||||
|
|
||||||
instance (Ord key, Semigroup value) => Semigroup (Map key value) where
|
instance (Ord key, Semigroup value) => Semigroup (Map key value) where
|
||||||
Map a <> Map b = Map (Map.unionWith (<>) a b)
|
Map a <> Map b = Map (Map.unionWith (<>) a b)
|
||||||
|
|
||||||
|
instance (Ord key, Semigroup value) => Monoid (Map key value) where
|
||||||
|
mempty = Map Map.empty
|
||||||
|
mappend = (<>)
|
||||||
|
Loading…
Reference in New Issue
Block a user