Monoid-subclasses: Subclasses of Monoid


#1

A bit over four years after the 0.1 initial release, monoid-subclasses-1.0 has been released. There are some slight backward compatibility breaks. Most significantly, some of the subclasses of Monoid have become subclasses of Semigroup instead. There are constraint synonyms in place for the old classes, so most client code should continue to work. I’m planning to deprecate the constraint synonyms with version 1.1.

Among other news, the new monoid subclass Monus has been introduced, together with its superclass OverlappingGCDMonoid that works for non-Abelian monoids.

Have fun!


#2

I like how FactorialMonoid fits with different representations of “packed” data like Text, ByteString or Vector.

For the OffsetPositioned and LinePositioned types, mappend “forgets” all positional information, doesn’t it? Perhaps it should be mentioned in the documentation.


#3

On the two types you mention, mappend preserves the position of the left argument – unless the left position is at 0 in which case it attempts to preserve the position of the right argument. I guess I should document it that way, thanks for pointing it out.