Closed
Description
The enum instances generated by c2hs only define "toEnum :: Enum a => Int -> a" and "fromEnum :: Enum a => a -> Int", relying on the built-in definitions of succ, pred and enumFromTo, however all these built-in functions assume that an Enum matches a contiguous range of Int.
C enums on the other hand don't have this requirement. As a result the generated instance will crash for the Enum instances generated for any such enum. Simple example:
enum HaskellCrasher {
Foo = 1,
Bar = 3,
Baz = 5
};
Trying to call "toEnum 2", will crash. As a result, so will "enumFromTo Foo Baz".