
Hi.
Independently of your proposal, there already is
https://hackage.haskell.org/package/EnumMap
Cheers,
Andres
On Tue, Mar 31, 2015 at 7:42 PM, Johannes Waldmann
Dear Cafe,
in containers, we have Data.IntMap/IntSet . Because of the underlying implementation (patricia trees), keys/elements indeed have to be Int (we need their bits).
This is a conflict with type-safety: I try to avoid Int, and use some newtype T = T Int instead. E.g., I want to distinguish several different indices for the same structure, like row and column numbers in (sparse) matrices, or vertices in bipartite graphs.
So, I made these trivial wrappers EnumMap and EnumSet: https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data
Is this reasonable (do from/toEnum really have zero cost)? Would this be a useful addition to containers?
- J.W.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe