Skip to content

Commit 33987bd

Browse files
authored
Merge pull request #16 from reflex-frp/no-fromJust
Get rid of `fromJust` in other `PatchMapWith*Move` variant
2 parents e1e7268 + 9f0f5f9 commit 33987bd

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Data/Patch/MapWithMove.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ patchThatChangesMap oldByIndex newByIndex = patch
202202
putRemainingKeys $ Set.delete k fromKs
203203
return $ NodeInfo (From_Move k) $ Just undefined -- There's an existing value, and it's here, so no patch necessary
204204
else do
205-
(fromK, remainingKeys) <- return . fromMaybe (error "patchThatChangesMap: impossible: fromKs was empty") $ Set.minView fromKs -- There's an existing value, but it's not here; move it here
205+
(fromK, remainingKeys) <- return $
206+
fromMaybe (error "PatchMapWithMove.patchThatChangesMap: impossible: fromKs was empty") $
207+
Set.minView fromKs -- There's an existing value, but it's not here; move it here
206208
putRemainingKeys remainingKeys
207209
return $ NodeInfo (From_Move fromK) $ Just undefined
208210
Map.traverseWithKey f newByIndex

src/Data/Patch/MapWithPatchingMove.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ patchThatChangesMap oldByIndex newByIndex = patch
268268
putRemainingKeys $ Set.delete k fromKs
269269
return $ NodeInfo (From_Move k mempty) $ Just undefined -- There's an existing value, and it's here, so no patch necessary
270270
else do
271-
(fromK, remainingKeys) <- return . fromJust $ Set.minView fromKs -- There's an existing value, but it's not here; move it here
271+
(fromK, remainingKeys) <- return $
272+
fromMaybe (error "PatchMapWithPatchingMove.patchThatChangesMap: impossible: fromKs was empty") $
273+
Set.minView fromKs -- There's an existing value, but it's not here; move it here
272274
putRemainingKeys remainingKeys
273275
return $ NodeInfo (From_Move fromK mempty) $ Just undefined
274276
Map.traverseWithKey f newByIndex

0 commit comments

Comments
 (0)