From 7babb1b01ce2d200dac1689bc23024d5c6092235 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Tue, 28 Aug 2012 14:38:36 +0100 Subject: Big changes on tc-untouchables branch (Before merging to HEAD we need to tidy up and write a proper commit message.) --- compiler/utils/UniqFM.lhs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'compiler/utils/UniqFM.lhs') diff --git a/compiler/utils/UniqFM.lhs b/compiler/utils/UniqFM.lhs index d4a270dd0e..7b5a7aae44 100644 --- a/compiler/utils/UniqFM.lhs +++ b/compiler/utils/UniqFM.lhs @@ -51,7 +51,7 @@ module UniqFM ( foldUFM, foldUFM_Directly, mapUFM, mapUFM_Directly, elemUFM, elemUFM_Directly, - filterUFM, filterUFM_Directly, + filterUFM, filterUFM_Directly, partitionUFM, sizeUFM, isNullUFM, lookupUFM, lookupUFM_Directly, @@ -146,6 +146,7 @@ mapUFM :: (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2 mapUFM_Directly :: (Unique -> elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2 filterUFM :: (elt -> Bool) -> UniqFM elt -> UniqFM elt filterUFM_Directly :: (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt +partitionUFM :: (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt) sizeUFM :: UniqFM elt -> Int --hashUFM :: UniqFM elt -> Int @@ -232,6 +233,8 @@ mapUFM f (UFM m) = UFM (M.map f m) mapUFM_Directly f (UFM m) = UFM (M.mapWithKey (f . getUnique) m) filterUFM p (UFM m) = UFM (M.filter p m) filterUFM_Directly p (UFM m) = UFM (M.filterWithKey (p . getUnique) m) +partitionUFM p (UFM m) = case M.partition p m of + (left, right) -> (UFM left, UFM right) sizeUFM (UFM m) = M.size m elemUFM k (UFM m) = M.member (getKey $ getUnique k) m -- cgit v1.2.1