<div dir="ltr">Wouldn't you get the same result with using unordered-containers and a Hashable instance for your Enums? See: <a href="https://hackage.haskell.org/package/hashable-1.2.2.0/docs/Data-Hashable.html#g:8">https://hackage.haskell.org/package/hashable-1.2.2.0/docs/Data-Hashable.html#g:8</a><div><br></div><div>Patrick</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 31, 2015 at 6:42 PM, Johannes Waldmann <span dir="ltr"><<a href="mailto:waldmann@imn.htwk-leipzig.de" target="_blank">waldmann@imn.htwk-leipzig.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Cafe,<br>
<br>
in containers, we have Data.IntMap/IntSet .<br>
Because of the underlying implementation (patricia trees),<br>
keys/elements indeed have to be Int (we need their bits).<br>
<br>
This is a conflict with type-safety: I try to avoid Int,<br>
and use some  newtype T = T Int  instead.<br>
E.g., I want to distinguish several different indices<br>
for the same structure, like row and column numbers<br>
in (sparse) matrices, or vertices in bipartite graphs.<br>
<br>
So, I made these trivial wrappers EnumMap and EnumSet:<br>
<a href="https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data" target="_blank">https://github.com/jwaldmann/satchmo-solver/tree/master/src/Data</a><br>
<br>
Is this reasonable (do from/toEnum really have zero cost)?<br>
Would this be a useful addition to containers?<br>
<br>
- J.W.<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>