numericEnumFromThen breaks standard behaviour in presence of ⊥
Haskell 2010 (and, for what it's worth, 98) require the following behaviour for numericEnumFromThen:
numericEnumFromThen n m = iterate (+(m-n)) n
but GHC has:
numericEnumFromThen n m = n `seq` m `seq` (n : numericEnumFromThen m (m+m-n))
The standard evaluation of numericEnumFromThen 0.0 undefined is equivalent to 0.0 : repeat undefined, but GHC evaluates it as undefined:
> Prelude> [0.0, undefined..]
*** Exception: Prelude.undefined
So unfortunately, this optimisation changes semantics in violation of the Report.
numericEnumFrom also suffers from this issue; the evaluation of numericEnumFrom undefined should be equivalent to repeat undefined, but GHC evaluates it as undefined. This is a more minor issue, however. :)
(Tested with 7.0.3 and whatever version lambdabot uses on freenode.)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |