Discussion:
unknown
1970-01-01 00:00:00 UTC
Permalink
Because [fromEnum A .. ] is [0 .. ], which is [0 .. maxBound :: Int] and=20
the derived Enum instance calls error for arguments of toEnum outside the=20
range [0 .. number of constructors - 1].
=C2=BFWhy the expression 2) doesn't not produce the same error?
The derived Enum instance is cleverer, it uses the number of constructors=20
in the datatype to determine upper bounds for enum

Loading...