[Haskell-cafe] Re: [Haskell] ANN: The Typeclassopedia, and request for feedback

Luke Palmer lrpalmer at gmail.com
Mon Feb 16 22:41:29 EST 2009

On Mon, Feb 16, 2009 at 8:13 PM, wren ng thornton <wren at freegeek.org> wrote:

> Isaac Dupree wrote:
>> Natural numbers under min don't form a monoid, only naturals under max do
>> (so you can have a zero element)
> Though, FWIW, you can use Nat+1 with the extra value standing for Infinity
> as the identity of min (newtype Min = Maybe Nat).

Indeed, as well as you can use lazy naturals with infinity as the unit:

data Nat = Zero | Succ Nat
infinity = Succ infinity
min Zero _ = Zero
min _ Zero = Zero
min (Succ x) (Succ y) = Succ (min x y)

> I bring this up mainly because it can be helpful to explain how we can take
> the "almost monoid" of min at Nat and monoidize it. Showing how this is
> similar to and different from max at Nat is enlightening. Showing the min
> monoid on negative naturals with 0 as the identity, and no need for the
> "special" +1 value, would help drive the point home. (Also, the min/max
> duality is mirrored in intersection/union on sets where we need to introduce
> either the empty set (usually trivial) or the universal set (usually
> overlooked).)
> Or maybe that would be better explained in a reference rather than the main
> text.
> --
> Live well,
> ~wren
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090216/a8ea9219/attachment.htm

More information about the Haskell-Cafe mailing list