
31 Mar
2015
31 Mar
'15
5:42 p.m.
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.