Hi,

From Section 10 of the Haskell report, regarding automatic derivation:

to derive Bounded for a type: "the type must be either an enumeration
(all constructors must be nullary) or have only one constructor."

This seems a very artificial restriction - since it allows you to be
in any one of two camps, but no where in between. It also means that
Either doesn't derive Bounded, while it could easily do so:

instance (Bounded a, Bounded b) => Bounded (Either a b) where
   minBound = Left minBound
   maxBound = Right maxBound

So I propose that this restriction be lifted, and that the obvious
extension be given such that minBound is the lowest constructor with a
pile of minBounds, and maxBound is the highest constructor with a pile
of maxBound.

This proposal has been implemented in Derive:
http://www-users.cs.york.ac.uk/~ndm/derive/

Thanks

Neil
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to