@@ -1242,6 +1242,7 @@ prop_mergeWithKeyModel xs ys
12421242 (Nothing , Just y) -> if keep_y then Just (k, y) else Nothing
12431243 (Just x, Nothing ) -> if keep_x then Just (k, x) else Nothing
12441244 (Just x, Just y) -> (\ v -> (k, v)) `fmap` f k x y
1245+ (Nothing , Nothing ) -> error " impossible"
12451246
12461247 -- We prevent inlining testMergeWithKey to disable the SpecConstr
12471248 -- optimalization. There are too many call patterns here so several
@@ -1914,14 +1915,18 @@ prop_maxViewWithKey m = case maxViewWithKey m of
19141915prop_minView :: Map Int A -> Property
19151916prop_minView m = case minView m of
19161917 Nothing -> property $ null m
1917- Just (x,m') | ~ (_,x'): xs' <- toList m ->
1918- valid m' .&&. x == x' .&&. toList m' === xs'
1918+ Just (x,m') -> valid m' .&&. kxs === (minKey, x) : toList m'
1919+ where
1920+ kxs = toList m
1921+ minKey = minimum (fmap fst kxs)
19191922
19201923prop_maxView :: Map Int A -> Property
19211924prop_maxView m = case maxView m of
19221925 Nothing -> property $ null m
1923- Just (x,m') | ~ (_,x'): xs' <- toDescList m ->
1924- valid m' .&&. x == x' .&&. toDescList m' === xs'
1926+ Just (x,m') -> valid m' .&&. kxs === (maxKey, x) : toDescList m'
1927+ where
1928+ kxs = toDescList m
1929+ maxKey = maximum (fmap fst kxs)
19251930
19261931prop_isSubmapOf :: Map Int A -> Map Int A -> Property
19271932prop_isSubmapOf m1 m2 = isSubmapOf m1 m2 === all (`elem` kys) (toList m1)
0 commit comments