@@ -32,16 +32,15 @@ import Type.Data.RowList (RLProxy(..))
3232-- | ### Newtypes for Monoid
3333-- |
3434-- | Some types (e.g. `Int`, `Boolean`) can implement multiple law-abiding
35- -- | instances for `Monoid`. For example, `<>` could be `+` and `mempty` could
36- -- | be `0`. Likewise, `<>` could be `*` and `mempty` could be `1`.
37- -- | To workaround these ambiguous situations, one should use newtypes
38- -- | to specify which instance should be used:
39- -- | - `Additive`: use `Semiring`'s `plus`/`+` and `zero` for `<>` and `mempty`.
40- -- | - `Multiplicative`: use `Semiring`'s `mul`/`*` and `one` for `<>` and `mempty`.
41- -- | - `Conj`: use `HeytingAlgebra`'s `conj`/`&&` and `tt` for `<>` and `mempty`.
42- -- | - `Disj`: use `HeytingAlgebra`'s `disj`/`||` and `ff` for `<>` and `mempty`.
43- -- | - `Endo`: use `Category`'s `compose`/`<<<` and `identity` for `<>` and `mempty`.
44- -- | - `Dual`: use `Category`'s `composeFlipped`/`>>>` and `identity` for `<>` and `mempty`.
35+ -- | instances for `Monoid`. Let's use `Int` as an example
36+ -- | 1. `<>` could be `+` and `mempty` could be `0`
37+ -- | 2. `<>` could be `*` and `mempty` could be `1`.
38+ -- |
39+ -- | To clarify these ambiguous situations, one should use the newtypes
40+ -- | defined in `Data.Monoid.<NewtypeName>` modules.
41+ -- |
42+ -- | In the above ambiguous situation, we could use `Additive`
43+ -- | for the first situation or `Multiplicative` for the second one.
4544class Semigroup m <= Monoid m where
4645 mempty :: m
4746
0 commit comments