Closed
Description
With the canonical Enum
instance for the following data type
data T = A | B | C | D
I get:
> enumFromTo A A :: Array T
[A]
> enumFromTo A B :: Array T
[A,B]
> enumFromTo A C :: Array T
[A,B,C]
> enumFromTo A D :: Array T
[A,B,C]
The last one returns a wrong result with the current implementation for enumFromTo
because the unfoldr-function calls succ D
, which short-circuits in the Maybe monad and breaks the unfoldr 'loop'.
Note: this only fails for bounded Enums
Metadata
Metadata
Assignees
Labels
No labels