Maximum and Minimum monoids
strake888 at gmail.com
Sat Dec 29 00:50:45 CET 2012
On 28/12/2012, Edward Kmett <ekmett at gmail.com> wrote:
> And they are already present in the semigroups package with those names and
> that Monoid.
Ah, sorry, missed the Monoid instance.
On 28/12/2012, Gabriel Gonzalez <gabriel439 at gmail.com> wrote:
> Moreover, the entire Bounded constraint seems wrong in principle. There
> is no intuitive reason why some type should be bounded to be able to
> take a maximum of a set of elements. The Ord constraint should be
> sufficient to define a maximum.
No; the set may be empty.
> I also don't think it is a good idea to have direct Monoid instances for
> Max and Min, because they behave weirdly on empty lists. Do you really
> think that "minimum  :: Int" should be defined?
If we had the Bounded constraint, it wouldn't be.
More information about the Libraries