[Haskell-cafe] Re: Why is Day and Month bounded?

David Roundy droundy at darcs.net
Fri Jul 14 08:24:15 EDT 2006


Interestingly, your Cyclic class idea may have practical purposes
beyond enumeration.  Integers modulo some number are also cyclical,
and can come in very handy.  In fact, raw unsigned ints are modulo
2^32 (or something like that), so they really ought (under one
interpretation) to be members of Cyclic rather than Bounded.  It would
certainly be more efficient, since you wouldn't need to do any
overflow checking, and the cpu implements the Cyclic operations, but
not the Bounded operations.  Anyhow, just thought I'd mention that
this isn't useful only for "ordinary" cyclic objects like dates.
-- 
David Roundy


More information about the Haskell-Cafe mailing list