GHC internal data types are currently a bit of a mess.
In particular there is a certain growth of Set/Map types, all doing the same thing but often providing different interfaces without good reason.
While there are reasons to chose
plus for adding an element to a data structure there is no reason to use all three in the same codebase.
Some examples taken from EnumSet/VarSet:
fromList :: Enum a => [a] -> EnumSet a
mkDVarSet :: [Var] -> DVarSet
toList :: Enum a => EnumSet a -> [a]
dVarSetElems :: DVarSet -> [Var]
extendVarSet :: VarSet -> Var -> VarSet
insert :: Enum a => a -> EnumSet a -> EnumSet a
There will always be certain type specific parts of a interface like
But I don't see why we shouldn't try to standardize somewhat the core operations on the Set/Map types.
This patch is however only a start and not a solution. It does:
- Remove a few unused types
- Make IsSet*/IsMap* more wildly useable as a common interface to the different Set/Map types by pulling it out of
- Move generic data structures into their own folder from util.
- Move EnumSet over to the IsSet interface.
- Split IsSet into a base clase and deterministic and non-deterministic subclasses.