What if we say that Enum a generalization, rather than a wrapper, of Int? If the benchmarks are even, is there a reason to use the more specific structure rather than the general one? I don't know if Enum being "more complex" outweighs the benefits of it being "more general" (if the EnumMap matches IntMap for speed).
Thoughts? On Sat, Aug 8, 2009 at 6:11 PM, Henning Thielemann<[email protected]> wrote: > > On Sat, 8 Aug 2009, John Van Enk wrote: > >> 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 > > Can you implement EnumMap in terms of the Enum methods, without many > conversions to Int? I mean, if you often convert to Int and back then you > could achieve the same on top of IntMap. Generally I prefer the strategy > "from simple to complex". I consider Enum to be a "wrapper" around Int. > http://haskell.org/haskellwiki/Simple_to_complex > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
