
David Menendez
That depends on what "outside the Enum range" means. You'll get an exception if you somehow get an Int key in the map which doesn't correspond to any value in the enum, but you don't get an exception if you try to pass in, say, a large Integer.
Prelude> fromEnum (2^32) 0
Yes, but: Prelude Data.Int> fromEnum (2^32 :: Int64) *** Exception: Enum.fromEnum{Int64}: value (4294967296) is outside of Int's bounds (-2147483648,2147483647) so apparently, different Enum instances deal with this differently.
From GHC.Num:
instance Enum Integer where [...] fromEnum n = I# (toInt# n)
From GHC.Int:
instance Enum Int64 where [...] fromEnum x@(I64# x#) | x >= fromIntegral (minBound::Int) && x <= fromIntegral (maxBound::Int) = I# (int64ToInt# x#) | otherwise = fromEnumError "Int64" x -k -- If I haven't seen further, it is by standing in the footprints of giants