News for hackers. Stuff that matters.
Re:What Monoids teach us about software by dllthomas on Wednesday September 13, 2017 @06:36PM (#15243380)
It's maybe worth noting that we have a choice of how values are merged on collision. I think it's a monoid only when that choice forms a semigroup.

In the case of configurations, "right bias" (aka Last) is probably a good choice. I don't like that Haskell chose it for the general Map instance.

Re:What Monoids teach us about software by whateveracct on Wednesday September 13, 2017 @07:35PM (#15243745)
Yeah the Map monoid instance is very unfortunate :( When I came from Scala I really missed the one in scalaz (which is as you describe)

reducers has a UnionWith newtype which gives you the better Map monoid. But I think it uses a lazy unionWith, which will cause your Map to leak space when used in a foldMap over many elements :(