Thu, 3 Feb 2000 23:56:02 +1300 (NZD), Tom Pledger <[EMAIL PROTECTED]> pisze:

> I hope that Double isn't Bounded.  Double was meant to be one of the
> "other things" in the opening remark:
> 
>     "Everything which is both an X and a Y is also a Z, and some other
>      things are Zs too."

OK, the trouble case doesn't show up in standard Haskell types and
is very rare in practice, but let's consider a type of numbers in the
interval [0..1], such that RGB color is a triple of such numbers. Then
it's Enum and Bounded, but random value should be computed differently.

More generally, the problem is that we don't want to only decide
whether a type is Z or not. We also want to supply a function
definition which specifies the *way* in which a type is Z. If X is
not required for Z, the mere presence of X should not constrain the
way of being Z!

By accident being Enum almost always means that we can easily
enumerate all values - but not always. If it was always, we could
simply require a type to be Enum & Bounded and not have a separate
Random class. It's not always, so we define Random seperately. Being
Bounded does not automatically cause it to always hold, although it
already held in most cases, with exceptions by accident not being
Bounded, so that's why you proposal seemed to work.

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-

Reply via email to