Repository : ssh://darcs.haskell.org//srv/darcs/packages/hoopl On branch : master
http://hackage.haskell.org/trac/ghc/changeset/038658b5605af91b6180a4a8d82cb1696d6421b4 >--------------------------------------------------------------- commit 038658b5605af91b6180a4a8d82cb1696d6421b4 Author: Simon Marlow <[email protected]> Date: Wed Jul 18 13:59:54 2012 +0100 add mapFilter >--------------------------------------------------------------- src/Compiler/Hoopl/Collections.hs | 1 + src/Compiler/Hoopl/Label.hs | 1 + src/Compiler/Hoopl/Unique.hs | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/Compiler/Hoopl/Collections.hs b/src/Compiler/Hoopl/Collections.hs index e7b1755..774ef54 100644 --- a/src/Compiler/Hoopl/Collections.hs +++ b/src/Compiler/Hoopl/Collections.hs @@ -72,6 +72,7 @@ class IsMap map where mapMapWithKey :: (KeyOf map -> a -> b) -> map a -> map b mapFold :: (a -> b -> b) -> b -> map a -> b mapFoldWithKey :: (KeyOf map -> a -> b -> b) -> b -> map a -> b + mapFilter :: (a -> Bool) -> map a -> map a mapElems :: map a -> [a] mapKeys :: map a -> [KeyOf map] diff --git a/src/Compiler/Hoopl/Label.hs b/src/Compiler/Hoopl/Label.hs index e8a7f0b..b0cc71b 100644 --- a/src/Compiler/Hoopl/Label.hs +++ b/src/Compiler/Hoopl/Label.hs @@ -91,6 +91,7 @@ instance IsMap LabelMap where mapMapWithKey f (LM m) = LM (mapMapWithKey (f . uniqueToLbl) m) mapFold k z (LM m) = mapFold k z m mapFoldWithKey k z (LM m) = mapFoldWithKey (k . uniqueToLbl) z m + mapFilter f (LM m) = LM (mapFilter f m) mapElems (LM m) = mapElems m mapKeys (LM m) = map uniqueToLbl (mapKeys m) diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs index b69cbee..563f83a 100644 --- a/src/Compiler/Hoopl/Unique.hs +++ b/src/Compiler/Hoopl/Unique.hs @@ -90,6 +90,7 @@ instance IsMap UniqueMap where mapMapWithKey f (UM m) = UM (M.mapWithKey (f . intToUnique) m) mapFold k z (UM m) = M.fold k z m mapFoldWithKey k z (UM m) = M.foldWithKey (k . intToUnique) z m + mapFilter f (UM m) = UM (M.filter f m) mapElems (UM m) = M.elems m mapKeys (UM m) = M.keys m _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
