
On Mon, Feb 16, 2009 at 8:13 PM, wren ng thornton
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@Nat and monoidize it. Showing how this is similar to and different from max@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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe