Container type classes

Andreas Klebinger klebinger.andreas at gmx.at
Wed May 29 10:48:17 UTC 2019


ghc-devs-request at haskell.org schrieb:
> Hello,
>
> I think refactoring to use consistent naming is a good idea, but I am
> not sure about the class idea.
>
> To see if it is viable, we should list the types in question and the
> operations we'd like to overload.
>
> I find that with containers there tend to be two cases: either the
> operations are similar but not exactly the same and you have to do
> type hackery to make things fit, or you realize that you can just use
> the same type in multiple places.
>
> Iavor
The function prototype are already part of the merge request. See here:
https://gitlab.haskell.org/ghc/ghc/blob/a0781d746c223636a90a0837fe678aab5b70e4b6/compiler/structures/Collections.hs

As for the data structures in question these are:
* EnumSet
* Data.IntSet
* Data.Set
* UniqSet
* UniqDSet

* Data.IntMap
* Data.Map
* LabelMap
* UniqFM
* UniqDFM
* UniqMap

* Maybe the TrieMap Variants

Maybe I missed some but these are all I can think of currently. But they
are already plenty.

Imo using type classes IS a kind of type hackery required "to make
things fit".


More information about the ghc-devs mailing list