diff --git a/src/Data/Patch.hs b/src/Data/Patch.hs index 0f5cef6..b8c805b 100644 --- a/src/Data/Patch.hs +++ b/src/Data/Patch.hs @@ -28,6 +28,7 @@ import Control.Applicative (liftA2) import Data.Semigroup (Semigroup (..)) #endif +import qualified Data.Semigroup.Commutative as X import Data.Patch.Class as X import Data.Patch.DMap as X hiding (getDeletions) import Data.Patch.DMapWithMove as X diff --git a/src/Data/Patch/MapWithPatchingMove.hs b/src/Data/Patch/MapWithPatchingMove.hs index 62d1db2..82aaf26 100644 --- a/src/Data/Patch/MapWithPatchingMove.hs +++ b/src/Data/Patch/MapWithPatchingMove.hs @@ -231,8 +231,9 @@ patchThatSortsMapWith cmp m = PatchMapWithPatchingMove $ Map.fromList $ catMaybe Just (from, to) reverseMapping = Map.fromList $ catMaybes $ zipWith f unsorted sorted g (to, _) (from, _) = if to == from then Nothing else - let Just movingTo = Map.lookup from reverseMapping + let movingTo = fromMaybe err $ Map.lookup from reverseMapping in Just (to, NodeInfo (From_Move from mempty) $ Just movingTo) + err = error "IMPOSSIBLE happens in patchThatSortsMapWith" -- | Create a 'PatchMapWithPatchingMove' that, if applied to the first 'Map' provided, -- will produce a 'Map' with the same values as the second 'Map' but with the