@@ -87,6 +87,24 @@ pInsertLookupWithKeyValueStrict f k v m
8787 not (isBottom $ M. insertLookupWithKey (const3 1 ) k bottom m)
8888 | otherwise = isBottom $ M. insertLookupWithKey (apply3 f) k bottom m
8989
90+ pFilterWithKey :: Fun (Int , Int ) Bool -> IMap -> Property
91+ pFilterWithKey fun m =
92+ valid m' .&&. toList m' === Prelude. filter (apply fun) (toList m)
93+ where
94+ m' = filterWithKey (apply2 fun) m
95+
96+ -- pFilterKeys :: Fun (Int, Int) Bool -> IMap -> Property
97+ -- pFilterKeys fun m =
98+ -- valid m' .&&. toList m' === Prelude.filter (apply fun) (toList m)
99+ -- where
100+ -- m' = filterKeys (apply2 fun) m
101+
102+ -- pFilter :: Fun (Int, Int) Bool -> IMap -> Property
103+ -- pFilter fun m =
104+ -- valid m' .&&. toList m' === Prelude.filter (apply fun) (toList m)
105+ -- where
106+ -- m' = filter (apply2 fun) m
107+
90108------------------------------------------------------------------------
91109-- test a corner case of fromAscList
92110--
@@ -199,6 +217,7 @@ tests =
199217 pInsertLookupWithKeyValueStrict
200218 , testProperty " fromAscList is somewhat value-lazy" pFromAscListLazy
201219 , testProperty " fromAscList is somewhat value-strict" pFromAscListStrict
220+ , testProperty " filterWithKey" pFilterWithKey
202221#if __GLASGOW_HASKELL__ >= 806
203222 , testProperty " strict foldr'" pStrictFoldr'
204223 , testProperty " strict foldl'" pStrictFoldl'
0 commit comments