[project @ 2000-05-25 12:41:14 by simonpj]
[ghc-hetmet.git] / ghc / compiler / basicTypes / VarSet.lhs
index 277c5d3..faf1db1 100644 (file)
@@ -5,7 +5,7 @@
 
 \begin{code}
 module VarSet (
-       VarSet, IdSet, TyVarSet, IdOrTyVarSet,
+       VarSet, IdSet, TyVarSet, UVarSet,
        emptyVarSet, unitVarSet, mkVarSet,
        extendVarSet,
        elemVarSet, varSetElems, subVarSet,
@@ -13,7 +13,7 @@ module VarSet (
        intersectVarSet, intersectsVarSet,
        isEmptyVarSet, delVarSet, delVarSetByKey,
        minusVarSet, foldVarSet, filterVarSet,
-       lookupVarSet, mapVarSet,
+       lookupVarSet, mapVarSet, sizeVarSet, seqVarSet,
 
        uniqAway
     ) where
@@ -21,7 +21,7 @@ module VarSet (
 #include "HsVersions.h"
 
 import CmdLineOpts     ( opt_PprStyle_Debug )
-import Var             ( Var, Id, TyVar, IdOrTyVar, setVarUnique )
+import Var             ( Var, Id, TyVar, UVar, setVarUnique )
 import Unique          ( Unique, Uniquable(..), incrUnique, deriveUnique )
 import UniqSet
 import UniqFM          ( delFromUFM_Directly )
@@ -38,7 +38,7 @@ import Outputable
 type VarSet       = UniqSet Var
 type IdSet       = UniqSet Id
 type TyVarSet    = UniqSet TyVar
-type IdOrTyVarSet = UniqSet IdOrTyVar
+type UVarSet      = UniqSet UVar
 
 emptyVarSet    :: VarSet
 intersectVarSet        :: VarSet -> VarSet -> VarSet
@@ -58,6 +58,7 @@ lookupVarSet  :: VarSet -> Var -> Maybe Var
                        -- Returns the set element, which may be
                        -- (==) to the argument, but not the same as
 mapVarSet      :: (Var -> Var) -> VarSet -> VarSet
+sizeVarSet     :: VarSet -> Int
 filterVarSet   :: (Var -> Bool) -> VarSet -> VarSet
 subVarSet      :: VarSet -> VarSet -> Bool
 
@@ -79,12 +80,18 @@ mkVarSet    = mkUniqSet
 foldVarSet     = foldUniqSet
 lookupVarSet   = lookupUniqSet
 mapVarSet      = mapUniqSet
+sizeVarSet     = sizeUniqSet
 filterVarSet   = filterUniqSet
 a `subVarSet` b = isEmptyVarSet (a `minusVarSet` b)
 delVarSetByKey = delFromUFM_Directly   -- Can't be bothered to add this to UniqSet
 \end{code}
 
 \begin{code}
+seqVarSet :: VarSet -> ()
+seqVarSet s = sizeVarSet s `seq` ()
+\end{code}
+
+\begin{code}
 uniqAway :: VarSet -> Var -> Var
 -- Give the Var a new unique, different to any in the VarSet
 uniqAway set var