Time library underspecified
Fri, 15 Nov 2002 11:31:57 +1300
John Meacham writes:
| another useful thing would be
| endOfTime and beginningOfTime constants, representing the minimum and
| maximum values representable by ClockTime.
| Haskell mailing list
If you plan to use endOfTime and beginningOfTime mainly as sentinels,
and are happy to treat them as +infinity and -infinity for arithmetic,
a separate wrapper type may help.
I've found the following (abridged) useful for 'closing off' data
types which were otherwise open-ended:
> data Close a
> = Lo
> | Mid a
> | Hi
> deriving (Eq, Ord, Show)
> instance Bounded (Close a) where
> minBound = Lo
> maxBound = Hi
> instance Num a => Num (Close a) where ...
> instance Real a => Real (Close a) where ...
> instance Enum a => Enum (Close a) where ...
> instance Integral a => Integral (Close a) where ...