Open treeowl opened 8 years ago
The Monoid
instance for most maps is a massive footgun and should be replaced with a unionWith
-based one. But I don't know if we want to introduce a new typeclass. I also am not sure that Alt
(from semigroupoids
) or Alternative
are right, either: although they describe a Semigroup
or Monoid
on applicative functors, they usually often have an interpretation that might not be appropriate (there's usually a notion of "choiceyness" in those instances, although []
or Maybe
will do what you expect).
What if you used a quantified constraint like instance (GCompare k, forall a . Semigroup (f a)) => Monoid (DMap k f)
?
Pretty much everyone hates the
Monoid
instance forData.Map
. If you're not too terribly opposed to potentially breaking existing code to make future users happy, you can avoid the problem here.