[Haskell-cafe] Data.EnumMap ?
chpatrick at gmail.com
Tue Mar 31 17:53:00 UTC 2015
Wouldn't you get the same result with using unordered-containers and a
Hashable instance for your Enums? See:
On Tue, Mar 31, 2015 at 6:42 PM, Johannes Waldmann <
waldmann at imn.htwk-leipzig.de> wrote:
> 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:
> 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 at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe