Maximum and Minimum monoids
michael at snoyman.com
Sat Dec 29 17:50:34 CET 2012
On Fri, Dec 28, 2012 at 11:39 PM, Gabriel Gonzalez <gabriel439 at gmail.com>wrote:
> I'm still not convinced by the Bounded instance for Maybe, which seems
> like a hack. I would prefer to just use the Monoid instance for "Maybe
> (Max a)" and just fmap "getMaximum" over the result rather than pretend
> that Maybe is Bounded when it's not.
> 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.
Since I'm the one who initially mentioned the Bounded approach, let me say:
I agree with this reasoning. It made sense in my specific case, but in
general I don't think it's a good idea. Do we really want to make it
impossible to use Max and Min with Integers?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries