[Haskell-cafe] instance (Enum a) => IArray UArray a
Twan van Laarhoven
twanvl at gmail.com
Fri Jan 20 18:29:21 CET 2012
On 20/01/12 16:31, Mikhail Arefiev wrote:
> Is there a reason why there is no instance of (Enum a) => IArray
> UArray a (other than that it will require OverlappingInstances and/or
> IncoherentInstances if e. g. UArray of Bools is used in the same
> code)?
>
> ...
>
> Does having such thing make any sense?
The problem is that there are Enum instances for things for which
to/fromEnum doesn't make sense, such as Double, Float and Integer.
Prelude> fromEnum (12345678901234567890 :: Integer)
-6101065172474983726
You wouldn't want your Integers to be stored as Ints in an array.
Twan
More information about the Haskell-Cafe
mailing list