Maximum and Minimum monoids

wren ng thornton wren at freegeek.org
Wed Jan 2 05:05:22 CET 2013


On 12/29/12 7:25 PM, Ben Millwood wrote:
> On Sat, Dec 29, 2012 at 11:18 PM, wren ng thornton <wren at freegeek.org> wrote:
>> Please please, if we're going to abbreviate mathematical terms then we
>> ought to stick to the standard mathematical abbreviations: sup, inf.
>
> Agreed.
>
>> Personally, I'm fine with Min and Max as they are, because in particular
>> they capture the fact that we're dealing with total orders here. That is,
>> other than for empty sets, they do in fact return the maximum/minimum.
>> Whereas Sup and Inf bring to mind the fact that what we're dealing with is
>> a complete lattice, which need not be a total order. While Sup and Inf
>> make perfectly good monoids/semigroups, I'd prefer if they properly allow
>> all complete lattices rather than being unnecessarily restricted to Ord.
>
> I think your concerns here are legitimate, but I have to agree with
> Herbert that reference "maximal element" is problematic.

I agree that it is problematic, just not quite as problematic as the OP 
made it out to be.

> Is there anything wrong with just using the Max semigroup and, e.g.
> `sconcat . (minBound :|)`, or something similar?

Nothing wrong at all :)  I'd love to see semigroups become a more 
welcomed part of the core litany of Haskell.

-- 
Live well,
~wren



More information about the Libraries mailing list