polar-engine / hs-polar

Polar Game Engine is a modern, safe game engine written in Haskell.
http://polarengine.org
Apache License 2.0
6 stars 1 forks source link

Storage: Lookup by any key type #11

Closed ori-sky closed 8 years ago

ori-sky commented 8 years ago

This patch replaces the name=>index HashMap for vector storages with a HashMap from hash=>index nested within another HashMap by TypeRep.

Essentially this allows arbitrary values to be added as a lookup key for any index in a vector storage as long as that key is Hashable. This increases the number of lookups and insertions by 1 but all lookups and insertions still take place in amortized constant time!