Skip to content

Commit

Permalink
Merge pull request #16 from reflex-frp/no-fromJust
Browse files Browse the repository at this point in the history
Get rid of `fromJust` in other `PatchMapWith*Move` variant
  • Loading branch information
Ericson2314 authored Feb 5, 2020
2 parents e1e7268 + 9f0f5f9 commit 33987bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Data/Patch/MapWithMove.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ patchThatChangesMap oldByIndex newByIndex = patch
putRemainingKeys $ Set.delete k fromKs
return $ NodeInfo (From_Move k) $ Just undefined -- There's an existing value, and it's here, so no patch necessary
else do
(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
(fromK, remainingKeys) <- return $
fromMaybe (error "PatchMapWithMove.patchThatChangesMap: impossible: fromKs was empty") $
Set.minView fromKs -- There's an existing value, but it's not here; move it here
putRemainingKeys remainingKeys
return $ NodeInfo (From_Move fromK) $ Just undefined
Map.traverseWithKey f newByIndex
Expand Down
4 changes: 3 additions & 1 deletion src/Data/Patch/MapWithPatchingMove.hs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ patchThatChangesMap oldByIndex newByIndex = patch
putRemainingKeys $ Set.delete k fromKs
return $ NodeInfo (From_Move k mempty) $ Just undefined -- There's an existing value, and it's here, so no patch necessary
else do
(fromK, remainingKeys) <- return . fromJust $ Set.minView fromKs -- There's an existing value, but it's not here; move it here
(fromK, remainingKeys) <- return $
fromMaybe (error "PatchMapWithPatchingMove.patchThatChangesMap: impossible: fromKs was empty") $
Set.minView fromKs -- There's an existing value, but it's not here; move it here
putRemainingKeys remainingKeys
return $ NodeInfo (From_Move fromK mempty) $ Just undefined
Map.traverseWithKey f newByIndex
Expand Down

0 comments on commit 33987bd

Please sign in to comment.