Maximum and Minimum monoids

Gabriel Gonzalez gabriel439 at
Fri Dec 28 22:39:49 CET 2012

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.

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?  I still believe that 
the correct answer for "minimum []" should be Nothing or a similar type 
with a distinguished infinity like those that Roman proposed.``

More information about the Libraries mailing list