X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FUniqSet.lhs;h=129e333eb5dfc76a804276bb3b3bfbb48a93723f;hb=dac19c07b199bcce81cd29a8f858af7f97e9a21e;hp=182e95cdf4f063a8da1b5f928f05f0ed87c09784;hpb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/UniqSet.lhs b/ghc/compiler/utils/UniqSet.lhs index 182e95c..129e333 100644 --- a/ghc/compiler/utils/UniqSet.lhs +++ b/ghc/compiler/utils/UniqSet.lhs @@ -12,11 +12,11 @@ module UniqSet ( UniqSet, -- abstract type: NOT mkUniqSet, uniqSetToList, emptyUniqSet, unitUniqSet, - addOneToUniqSet, addListToUniqSet, delOneFromUniqSet, + addOneToUniqSet, addListToUniqSet, delOneFromUniqSet, delListFromUniqSet, unionUniqSets, unionManyUniqSets, minusUniqSet, elementOfUniqSet, mapUniqSet, intersectUniqSets, isEmptyUniqSet, filterUniqSet, sizeUniqSet, foldUniqSet, - elemUniqSet_Directly, lookupUniqSet + elemUniqSet_Directly, lookupUniqSet, hashUniqSet ) where #include "HsVersions.h" @@ -70,6 +70,9 @@ addOneToUniqSet (MkUniqSet set) x = MkUniqSet (addToUFM set x x) delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a delOneFromUniqSet (MkUniqSet set) x = MkUniqSet (delFromUFM set x) +delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a +delListFromUniqSet (MkUniqSet set) xs = MkUniqSet (delListFromUFM set xs) + addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a addListToUniqSet (MkUniqSet set) xs = MkUniqSet (addListToUFM set [(x,x) | x<-xs]) @@ -103,6 +106,9 @@ elemUniqSet_Directly x (MkUniqSet set) = maybeToBool (lookupUFM_Directly set x) sizeUniqSet :: UniqSet a -> Int sizeUniqSet (MkUniqSet set) = sizeUFM set +hashUniqSet :: UniqSet a -> Int +hashUniqSet (MkUniqSet set) = hashUFM set + isEmptyUniqSet :: UniqSet a -> Bool isEmptyUniqSet (MkUniqSet set) = isNullUFM set {-SLOW: sizeUFM set == 0-}