Enumerate values with an inferred stride and a given limit. If
x precedes
y (and therefore we're enumerating
forward) but
x succeeds
z (and therefore is past the
limit), then the result is empty. Similarly, if
x succeeds
y (and therefore we're enumerating backward) but
x
precedes
z (and therefore is past the limit), then the result
is empty. Otherwise the result is non-empty since it contains
x. Naturally, this should agree with
enumFromTo and
enumDownFromTo (assuming
Eq a, by magic if need be):
if succ x == Just y then enumFromThenTo x y z == enumFromTo x z
if pred x == Just y then enumFromThenTo x y z == enumDownFromTo x z
In the default implementation: if
fromEnum fails on any
argument, then the result is either
[] or
[x] (as
appropriate); and if
toEnum fails on any of the enumerated
integers, then the first failure terminates the enumeration. If either
of these properties is inappropriate, then you should override the
default. In GHC, the default implementation is a "good producer" for
list fusion.