This module defines the `Monoid`

=> `CancellativeMonoid`

=> `GCDMonoid`

class hierarchy.

- class (LeftCancellativeMonoid m, RightCancellativeMonoid m) => CancellativeMonoid m
- class (CancellativeMonoid m, LeftGCDMonoid m, RightGCDMonoid m) => GCDMonoid m
- class Monoid m => LeftCancellativeMonoid m where
- mstripPrefix :: m -> m -> Maybe m

- class Monoid m => RightCancellativeMonoid m where
- mstripSuffix :: m -> m -> Maybe m

- class LeftCancellativeMonoid m => LeftGCDMonoid m where
- commonPrefix :: m -> m -> m

- class RightCancellativeMonoid m => RightGCDMonoid m where
- commonSuffix :: m -> m -> m

# Classes

class (LeftCancellativeMonoid m, RightCancellativeMonoid m) => CancellativeMonoid m Source

Class of monoids for which the `mappend`

operation can be reverted while satisfying the following laws:

mstripPrefix a (a `mappend` b) == Just b mstripSuffix b (a `mappend` b) == Just a maybe b (a `mappend`) (mstripPrefix a b) == b maybe b (`mappend` a) (mstripSuffix a b) == b

class (CancellativeMonoid m, LeftGCDMonoid m, RightGCDMonoid m) => GCDMonoid m Source

Class of monoids that allow the greatest common denominator to be found for any two given values. The operations must satisfy the following laws:

commonPrefix (a `mappend` b) (a `mappend` c) == a `mappend` commonPrefix b c commonSuffix (a `mappend` c) (b `mappend` c) == commonSuffix a b `mappend` c

class Monoid m => LeftCancellativeMonoid m whereSource

Class of monoids with a left inverse of `mappend`

, satisfying the following law:

mstripPrefix a (a `mappend` b) == Just b maybe b (a `mappend`) (mstripPrefix a b) == b

mstripPrefix :: m -> m -> Maybe mSource

class Monoid m => RightCancellativeMonoid m whereSource

Class of monoids with a right inverse of `mappend`

, satisfying the following law:

mstripSuffix b (a `mappend` b) == Just a maybe b (`mappend` a) (mstripSuffix a b) == b

mstripSuffix :: m -> m -> Maybe mSource

class LeftCancellativeMonoid m => LeftGCDMonoid m whereSource

commonPrefix :: m -> m -> mSource

LeftGCDMonoid ByteString | |

LeftGCDMonoid Text | |

Eq x => LeftGCDMonoid [x] |

class RightCancellativeMonoid m => RightGCDMonoid m whereSource

commonSuffix :: m -> m -> mSource