jaspervdj / psqueues

Priority Search Queues in three different flavors for Haskell
https://hackage.haskell.org/package/psqueues
Other
64 stars 24 forks source link

Consider valueless versions #9

Open treeowl opened 8 years ago

treeowl commented 8 years ago

On occasion, keys and priorities are sufficient. Cutting out the values should save one word per element currently wasted on ().

jaspervdj commented 8 years ago

I wonder if there is a smart-ish version that doesn't require us to duplicate the whole codebase.

unordered-containers simply uses newtype HashSet a = HashSet (HashMap a ()), but I don't think it's worth adding such a version since it doesn't save a word which is the whole point.

meiersi commented 8 years ago

One could probably abstract over the constructors and pattern-matching using a type-class with associated types. One could then write the functions generically, and use explicit specialization and concrete type signatures to gain the two fast and desired implementations.

Jasper Van der Jeugt notifications@github.com schrieb am Sa., 24. Okt. 2015 11:52 AM:

I wonder if there is a smart-ish version that doesn't require us to duplicate the whole codebase.

unordered-containers simply uses newtype HashSet a = HashSet (HashMap a ()), but I don't think it's worth adding such a version since it doesn't save a word which is the whole point.

— Reply to this email directly or view it on GitHub https://github.com/bttr/psqueues/issues/9#issuecomment-150779901.