Keith Wansbrough <[EMAIL PROTECTED]>
wrote on July 8
>> I find this a little surprising. In general, any algebraic datatype
>> satisfying the conditions in Appendix D of the report should be
>> enumerable, using the same lexicographic ordering used in D.1 for Eq
>> and Ord.
[..]
>> Any problems with this?
> I've seen one problem in my proposal. It's fine for finite datatypes,
> but if at least one of the components is infinite, an enumeration will
> not include all the elements. I'm not sure if this is a problem.
>
> Consider
>
> data MyPair = MyPair Integer Integer
> deriving Enum {- not Haskell 98 -}
>
> [..]
>
My impression of Haskell-98 was that it does *not* require for
Enum a
to just enumerate all `a'. Probably, it means to map injectively
some interval of Integer (finite or infinite) to some subset of `a'.
As to data D a = D a deriving (Enum),
there is one, most natural way to lift Enum from `a' to D a.
Also many other instances (user defined too) could be `derived'
naturally for D a.
Why Haskell does not allow this?
And for other constructor kind, like say, Pair, List ...
"deriving" does not seem to make much sense.
Because there exist too many equally good ways to `enum' these
types. Hence, it is better to leave this for the possible separate
user Enum declaration.
------------------
Sergey Mechveliani
[EMAIL PROTECTED]