@@ -22,6 +22,7 @@ import qualified Data.Dependent.Map as DMap
2222import Data.Dependent.Sum (ShowTag (..), EqTag (..))
2323import Data.Functor.Constant
2424import Data.Functor.Misc
25+import Data.Functor.Product
2526import Data.GADT.Compare (GEq (..))
2627import Data.GADT.Show (GShow (..))
2728import qualified Data.Map as Map
@@ -266,10 +267,8 @@ instance GCompare k => Patch (PatchDMapWithMove k v) where
266267 From_Delete -> Just $ Constant ()
267268 _ -> Nothing
268269
269−-- | Get the values that will be deleted if the given patch is applied to the
270−-- given 'DMap'
271−getDeletions :: GCompare k => PatchDMapWithMove k v -> DMap k v' -> DMap k v'
272−getDeletions (PatchDMapWithMove p) m = DMap.mapMaybeWithKey (\_ -> getComposeMaybe) $ DMap.intersectionWithKey f p m
273− where f _ ni v = ComposeMaybe $ case getComposeMaybe $ _nodeInfo_to ni of
274− Just _ -> Nothing
275− Nothing -> Just v
270+-- | Get the values that will be deleted or moved if the given patch is applied
271+-- to the given 'DMap'.
272+getDeletionsAndMoves :: GCompare k => PatchDMapWithMove k v -> DMap k v' -> DMap k (Product v' (ComposeMaybe k))
273+getDeletionsAndMoves (PatchDMapWithMove p) m = DMap.intersectionWithKey f m p
274+ where f _ v ni = Pair v $ _nodeInfo_to ni