[Haskell-cafe] Data.EnumMap ?

Adam Gundry adam at well-typed.com
Tue Mar 31 19:15:43 UTC 2015


Dear Johannes,

On 31/03/15 19:06, Johannes Waldmann wrote:
> @Andres
> 
>> https://hackage.haskell.org/package/EnumMap
> 
> I was not aware. But that looks like an actual copy of the IntMap code,
> so it does not get maintained/updated? 
> That's why I was thinking of a wrapper module only.

There's also

https://hackage.haskell.org/package/enummapset
https://wiki.haskell.org/EnumSet_EnumMap

so this must be a good idea, since it's come up so many times. :-)

I've not looked at the performance overhead of this approach, but I have
used something quite similar, which uses Coercible instead of Enum. Of
course, that works only for newtypes of Int, but it is guaranteed to be
zero-cost.

Adam


-- 
Adam Gundry, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com/


More information about the Haskell-Cafe mailing list