Haskell 98: Enum Class

George Russell ger@tzi.de
Thu, 25 Oct 2001 12:35:19 +0200


Simon Peyton Jones suggested the following changes:
> 1. Move specification of enumFrom and friends from 3.10 to 6.3.4
> 
> 2. Specify that for bounded types, (succ maxBound) and (pred minBound)
> are errors.
> 
> 3.  Specify that succ and pred on numeric types just add/subtract 1
> (subject to
> (2) above.
> 
> 4. Rewrite D.2 to talk about deriving only, not about Enum in general.
> 
> 5.  In Appendix A, the Enum class defn, add comments to explain that the
> default methods only work for types whose fromEnum/toEnum range fits=20
> inside Int.
In addition, I suggest that, since it is widely agreed that the instances of
Enum for Float and Double are highly unsatisfactory, the report should give
these instances the same status as n+k patterns have (in 1.4 of the recent
revision).  In particular, their use should be "discouraged", and there 
should be a warning that the instances may be "altered or removed in Haskell 2".

It might clear the ground somewhat for Haskell 2 if there were a new section
containing a list of deprecated features; we can probably think of some other
things which should go in there.  In addition to what's said for n+k patterns,
I suggest the standard explicitly encourage (but not oblige) conforming compilers
to issue warnings when deprecated features are used.