Maximum and Minimum monoids
Roman Cheplyaka
roma at ro-che.info
Fri Dec 28 19:07:28 CET 2012
* Gabriel Gonzalez <gabriel439 at gmail.com> [2012-12-28 10:32:23-0600]
> I am definitely in favor of adding "semigroups" to the platform if
> drops the containers dependency. Optionally, we could then fix the
> Monoid instance for Maybe so that it has a proper semigroup context
> and we wouldn't have to use the Option type. I would be happy with
> that solution. However, if we do that then rename the types to "Max"
> and "Min" instead of "Maximum and "Minimum", since "Maybe (Max a)" is
> long enough as it is.
1. Actually, Max and Min are already there. No need to rename or do
anything.
2. The problem isn't that semigroups is not in the platform.
The problems are:
1. base already defines a (bad) Monoid instance for Maybe. We'll need
to ditch it (and possibly break some code by doing that).
2. Both Monoid and Maybe are defined in base, while Semigroup isn't.
So, such an instance will be orphaned.
So, the best solution seems to be to merge semigroups into base.
My proposal would be to move only Data.Semigroup to base, as it will
lead to significant simplification, but leave other modules (NonEmpty,
Natural) in a separate package, since they are of limited applicability
and would gain nothing by being inside base.
Roman
More information about the Libraries
mailing list