diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-08-28 14:38:36 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-08-28 14:38:36 +0100 |
commit | 7babb1b01ce2d200dac1689bc23024d5c6092235 (patch) | |
tree | 274256ac57094e9a918a61a29ad5734a1a2624fc /compiler/utils/UniqFM.lhs | |
parent | 1bbdbe55970310f92122fb5321b65705646835b4 (diff) | |
download | haskell-7babb1b01ce2d200dac1689bc23024d5c6092235.tar.gz |
Big changes on tc-untouchables branch
(Before merging to HEAD we need to tidy up and write a proper commit message.)
Diffstat (limited to 'compiler/utils/UniqFM.lhs')
-rw-r--r-- | compiler/utils/UniqFM.lhs | 5 |
1 files changed, 4 insertions, 1 deletions
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 |