
That's originally how I was thinking about doing it, but I think that requires one to re-implement all the functions available in Data.IntMap as simple wrappers that do the toEnum/fromEnum conversion. I think making it into its own module is a little cleaner. The conversion from EnumMap to IntMap is substantially cleaner than from IntMap to EnumMap:
type IntMap v = EnumMap Int v
/jve
On Sat, Aug 8, 2009 at 4:41 PM, Henning
Thielemann
On Sat, 8 Aug 2009, John Van Enk wrote:
Hi List,
I've uploaded a first version of EnumMap to hackage.
EnumMap is a generalization of IntMap that constrains the key to Enum rather than forcing it to be Int. I have no idea what impact this has on performance, but it still passes all the tests that ship with IntMap. (My guess is that performance will be similar/identical unless I've missed something.)
Could that be implemented as wrapper around IntMap?