@@ -120,11 +120,15 @@ patchThatSortsMapWith cmp m = PatchMapWithMove $ Map.fromList $ catMaybes $ zipW
120120-- will produce a 'Map' with the same values as the second 'Map' but with the
121121-- values sorted with the given ordering function.
122122patchThatChangesAndSortsMapWith :: forall k v. (Ord k, Ord v) => (v -> v -> Ordering) -> Map k v -> Map k v -> PatchMapWithMove k v
123−patchThatChangesAndSortsMapWith cmp oldByIndex newByIndexUnsorted = patch
124− where oldByValue = Map.fromListWith Set.union $ swap . first Set.singleton <$> Map.toList oldByIndex
125− newList = Map.toList newByIndexUnsorted
123+patchThatChangesAndSortsMapWith cmp oldByIndex newByIndexUnsorted = patchThatChangesMap oldByIndex newByIndex
124+ where newList = Map.toList newByIndexUnsorted
126125 newByIndex = Map.fromList $ zip (fst <$> newList) $ sortBy cmp $ snd <$> newList
127− insertsAndMoves :: Map k (NodeInfo k v)
126+
127+-- | Create a 'PatchMapWithMove' that, if applied to the first 'Map' provided,
128+-- will produce the second 'Map'.
129+patchThatChangesMap :: (Ord k, Ord v) => Map k v -> Map k v -> PatchMapWithMove k v
130+patchThatChangesMap oldByIndex newByIndex = patch
131+ where oldByValue = Map.fromListWith Set.union $ swap . first Set.singleton <$> Map.toList oldByIndex
128132 (insertsAndMoves, unusedValuesByValue) = flip runState oldByValue $ do
129133 let f k v = do
130134 remainingValues <- get