diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs
--- a/Data/IntMap/Internal.hs
+++ b/Data/IntMap/Internal.hs
@@ -1059,30 +1059,14 @@
                | zero p1 m2        = bin p2 m2 (go t1 l2) Nil
                | otherwise         = bin p2 m2 Nil (go t1 r2)
 
-    go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1'
-      where
-        merge0 t2 k2 t1@(Bin p1 m1 l1 r1)
-          | nomatch k2 p1 m1 = t1
-          | zero k2 m1 = binCheckLeft p1 m1 (merge0 t2 k2 l1) r1
-          | otherwise  = binCheckRight p1 m1 l1 (merge0 t2 k2 r1)
-        merge0 _ k2 t1@(Tip k1 _)
-          | k1 == k2 = Nil
-          | otherwise = t1
-        merge0 _ _  Nil = Nil
+    go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) =
+      filterWithKey (\k _ -> k `IntSet.notMember` t2') t1'
 
     go t1@(Bin _ _ _ _) IntSet.Nil = t1
 
-    go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2'
-      where
-        merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2)
-          | nomatch k1 p2 m2 = t1
-          | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil
-          | otherwise  = bin p2 m2 Nil (merge0 t1 k1 r2)
-        merge0 t1 k1 (IntSet.Tip k2 _)
-          | k1 == k2 = Nil
-          | otherwise = t1
-        merge0 t1 _  IntSet.Nil = t1
-
+    go t1'@(Tip k1' _) t2'
+      | k1' `IntSet.member` t2' = Nil
+      | otherwise = t1'
     go Nil _ = Nil
 
 
@@ -1120,30 +1104,13 @@
                | zero p1 m2        = bin p2 m2 (go t1 l2) Nil
                | otherwise         = bin p2 m2 Nil (go t1 r2)
 
-    go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1'
-      where
-        merge0 t2 k2 (Bin p1 m1 l1 r1)
-          | nomatch k2 p1 m1 = Nil
-          | zero k2 m1 = bin p1 m1 (merge0 t2 k2 l1) Nil
-          | otherwise  = bin p1 m1 Nil (merge0 t2 k2 r1)
-        merge0 _ k2 t1@(Tip k1 _)
-          | k1 == k2 = t1
-          | otherwise = Nil
-        merge0 _ _  Nil = Nil
-
+    go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) =
+      filterWithKey (\k _ -> k `IntSet.member` t2') t1'
     go (Bin _ _ _ _) IntSet.Nil = Nil
 
-    go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2'
-      where
-        merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2)
-          | nomatch k1 p2 m2 = Nil
-          | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil
-          | otherwise  = bin p2 m2 Nil (merge0 t1 k1 r2)
-        merge0 t1 k1 (IntSet.Tip k2 _)
-          | k1 == k2 = t1
-          | otherwise = Nil
-        merge0 _ _  IntSet.Nil = Nil
-
+    go t1'@(Tip k1' _) t2'
+      | k1' `IntSet.member` t2' = t1'
+      | otherwise = Nil
     go Nil _ = Nil
 
 -- | /O(n+m)/. The intersection with a combining function.
@@ -1574,7 +1541,7 @@
 --
 -- > preserveMissing :: SimpleWhenMissing x x
 --
--- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x)
+-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x)
 --
 -- but @preserveMissing@ is much faster.
 preserveMissing :: Applicative f => WhenMissing f x x
@@ -1620,7 +1587,7 @@
 --
 -- > filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x
 --
--- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
+-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
 --
 -- but this should be a little faster.
 filterMissing
@@ -1634,7 +1601,7 @@
 -- | Filter the entries whose keys are missing from the other map
 -- using some 'Applicative' action.
 --
--- > filterAMissing f = Lazy.Merge.traverseMaybeMissing $
+-- > filterAMissing f = Merge.Lazy.traverseMaybeMissing $
 -- >   \k x -> (\b -> guard b *> Just x) <$> f k x
 --
 -- but this should be a little faster.
diff --git a/Data/IntMap/Merge/Lazy.hs b/Data/IntMap/Merge/Lazy.hs
--- a/Data/IntMap/Merge/Lazy.hs
+++ b/Data/IntMap/Merge/Lazy.hs
@@ -33,9 +33,9 @@
 --
 -- The 'merge' and 'mergeA' functions are shared by
 -- the lazy and strict modules. Only the choice of merge tactics
--- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing'
--- from "Data.Map.Strict.Merge" then the results will be forced before
--- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from
+-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing'
+-- from "Data.Map.Merge.Strict" then the results will be forced before
+-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from
 -- this module then they will not.
 --
 -- == Efficiency note
diff --git a/Data/IntMap/Merge/Strict.hs b/Data/IntMap/Merge/Strict.hs
--- a/Data/IntMap/Merge/Strict.hs
+++ b/Data/IntMap/Merge/Strict.hs
@@ -33,10 +33,10 @@
 --
 -- The 'merge' and 'mergeA' functions are shared by
 -- the lazy and strict modules. Only the choice of merge tactics
--- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing'
+-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing'
 -- from this module then the results will be forced before they are
--- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from
--- "Data.Map.Lazy.Merge" then they will not.
+-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from
+-- "Data.Map.Merge.Lazy" then they will not.
 --
 -- == Efficiency note
 --
diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs
--- a/Data/Map/Internal.hs
+++ b/Data/Map/Internal.hs
@@ -348,7 +348,7 @@
     , MaybeS(..)
     , Identity(..)
 
-    -- Used by Map.Lazy.Merge
+    -- Used by Map.Merge.Lazy
     , mapWhenMissing
     , mapWhenMatched
     , lmapWhenMissing
@@ -2257,7 +2257,7 @@
 -- preserveMissing :: SimpleWhenMissing k x x
 -- @
 --
--- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x)
+-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x)
 --
 -- but @preserveMissing@ is much faster.
 preserveMissing :: Applicative f => WhenMissing f k x x
@@ -2304,7 +2304,7 @@
 -- filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x
 -- @
 --
--- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
+-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x
 --
 -- but this should be a little faster.
 filterMissing :: Applicative f
@@ -2318,7 +2318,7 @@
 -- using some 'Applicative' action.
 --
 -- @
--- filterAMissing f = Lazy.Merge.traverseMaybeMissing $
+-- filterAMissing f = Merge.Lazy.traverseMaybeMissing $
 --   \k x -> (\b -> guard b *> Just x) <$> f k x
 -- @
 --
diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs
--- a/Data/Map/Lazy.hs
+++ b/Data/Map/Lazy.hs
@@ -120,7 +120,7 @@
     , intersectionWithKey
 
     -- ** General combining functions
-    -- | See "Data.Map.Lazy.Merge"
+    -- | See "Data.Map.Merge.Lazy"
 
     -- ** Unsafe general combining function
 
diff --git a/Data/Map/Merge/Lazy.hs b/Data/Map/Merge/Lazy.hs
--- a/Data/Map/Merge/Lazy.hs
+++ b/Data/Map/Merge/Lazy.hs
@@ -33,9 +33,9 @@
 --
 -- The 'merge' and 'mergeA' functions are shared by
 -- the lazy and strict modules. Only the choice of merge tactics
--- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing'
--- from "Data.Map.Strict.Merge" then the results will be forced before
--- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from
+-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing'
+-- from "Data.Map.Merge.Strict" then the results will be forced before
+-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from
 -- this module then they will not.
 --
 -- == Efficiency note
diff --git a/Data/Map/Merge/Strict.hs b/Data/Map/Merge/Strict.hs
--- a/Data/Map/Merge/Strict.hs
+++ b/Data/Map/Merge/Strict.hs
@@ -33,10 +33,10 @@
 --
 -- The 'merge' and 'mergeA' functions are shared by
 -- the lazy and strict modules. Only the choice of merge tactics
--- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing'
+-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing'
 -- from this module then the results will be forced before they are
--- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from
--- "Data.Map.Lazy.Merge" then they will not.
+-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from
+-- "Data.Map.Merge.Lazy" then they will not.
 --
 -- == Efficiency note
 --
diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs
--- a/Data/Map/Strict.hs
+++ b/Data/Map/Strict.hs
@@ -128,7 +128,7 @@
     , intersectionWithKey
 
     -- ** General combining functions
-    -- | See "Data.Map.Strict.Merge"
+    -- | See "Data.Map.Merge.Strict"
 
     -- ** Deprecated general combining function
 
diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs
--- a/Data/Map/Strict/Internal.hs
+++ b/Data/Map/Strict/Internal.hs
@@ -1193,8 +1193,8 @@
 --
 -- WARNING: This function can produce corrupt maps and its results
 -- may depend on the internal structures of its inputs. Users should
--- prefer 'Data.Map.Strict.Merge.merge' or
--- 'Data.Map.Strict.Merge.mergeA'.
+-- prefer 'Data.Map.Merge.Strict.merge' or
+-- 'Data.Map.Merge.Strict.mergeA'.
 --
 -- When 'mergeWithKey' is given three arguments, it is inlined to the call
 -- site. You should therefore use 'mergeWithKey' only to define custom
diff --git a/Data/Tree.hs b/Data/Tree.hs
--- a/Data/Tree.hs
+++ b/Data/Tree.hs
@@ -100,13 +100,13 @@
       lcomp (Node a fr) (Node a' fr') = cmp a a' <> liftCompare lcomp fr fr'
 
 instance Show1 Tree where
-  liftShowsPrec shw shwl _p (Node a fr) =
+  liftShowsPrec shw shwl p (Node a fr) = showParen (p > 10) $
         showString "Node {rootLabel = " . shw 0 a . showString ", " .
           showString "subForest = " . liftShowList shw shwl fr .
           showString "}"
 
 instance Read1 Tree where
-  liftReadsPrec rd rdl _p = readParen False $
+  liftReadsPrec rd rdl p = readParen (p > 10) $
     \s -> do
       ("Node", s1) <- lex s
       ("{", s2) <- lex s1
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,8 +1,15 @@
 # Changelog for [`containers` package](http://github.com/haskell/containers)
 
-## 0.5.9.1
+## 0.5.9.2
 
-* Planned for GHC 8.2.
+* Fix completely broken implementations of `restrictKeys` and `withoutKeys`
+in `Data.IntMap`.
+
+* Fix minor bug in `Show1` instance for `Data.Tree`.
+
+* Fix broken documentation links.
+
+## 0.5.9.1
 
 * Add `merge` and `mergeA` for `Data.IntMap`.
 
diff --git a/containers.cabal b/containers.cabal
--- a/containers.cabal
+++ b/containers.cabal
@@ -1,5 +1,5 @@
 name: containers
-version: 0.5.9.1
+version: 0.5.9.2
 license: BSD3
 license-file: LICENSE
 maintainer: libraries@haskell.org
diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs
--- a/tests/intmap-properties.hs
+++ b/tests/intmap-properties.hs
@@ -167,6 +167,8 @@
              , testProperty "foldl'"               prop_foldl'
              , testProperty "keysSet"              prop_keysSet
              , testProperty "fromSet"              prop_fromSet
+             , testProperty "restrictKeys"         prop_restrictKeys
+             , testProperty "withoutKeys"          prop_withoutKeys
              ]
 
 apply2 :: Fun (a, b) c -> a -> b -> c
