[Haskell-cafe] EnumSet and EnumMap

Yitzchak Gale gale at sefer.org
Sun Feb 25 03:30:13 EST 2007


Chris Kuklewicz wrote:
> I have posted
> this useful wrapper on the Haskell wiki at
> http://haskell.org/haskellwiki/EnumSet_EnumMap

In my opinion, this is important enough that IntMap
and IntSet should be deprecated from the standard
libraries in favor of EnumMap and EnumSet.

Besides the obvious advantage of a huge increase
in generality at no performance cost (I think), there
is another reason.

The difference in interface been the Int and non-Int
versions of Set and Map forces you to make an
early decision about which to use. That decision
get pervasively hard-wired into your code.

The result is that it is sometimes hard to write flexible
polymorphic Haskell while still reserving the option
of switching to Int as an optimization.

Chris' idea fixes that problem.

Regards,
Yitz


More information about the Libraries mailing list