aboutsummaryrefslogtreecommitdiff
path: root/Command/Fsck.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-12-05 15:00:50 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-12-05 15:00:50 -0400
commit236c467da19f34edb08f124e37fd26eb62c43fcf (patch)
treef4e488f77fb954812e4d48f399fc2ecab072afea /Command/Fsck.hs
parentf013f71cb5d3f7eee3afb3eb8f01a33206d717c4 (diff)
more lambda-case conversion
Diffstat (limited to 'Command/Fsck.hs')
-rw-r--r--Command/Fsck.hs21
1 files changed, 9 insertions, 12 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index bc7a29f15..7884f0477 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -103,15 +103,13 @@ checkDeadRepo u =
earlyWarning "Warning: Fscking a repository that is currently marked as dead."
start :: Maybe Remote -> Incremental -> FilePath -> Key -> CommandStart
-start from inc file key = do
- v <- Backend.getBackend file key
- case v of
- Nothing -> stop
- Just backend -> do
- numcopies <- getFileNumCopies file
- case from of
- Nothing -> go $ perform key file backend numcopies
- Just r -> go $ performRemote key afile backend numcopies r
+start from inc file key = Backend.getBackend file key >>= \case
+ Nothing -> stop
+ Just backend -> do
+ numcopies <- getFileNumCopies file
+ case from of
+ Nothing -> go $ perform key file backend numcopies
+ Just r -> go $ performRemote key afile backend numcopies r
where
go = runFsck inc (mkActionItem afile) key
afile = AssociatedFile (Just file)
@@ -142,9 +140,8 @@ performRemote key afile backend numcopies remote =
dispatch (Left err) = do
showNote err
return False
- dispatch (Right True) = withtmp $ \tmpfile -> do
- r <- getfile tmpfile
- case r of
+ dispatch (Right True) = withtmp $ \tmpfile ->
+ getfile tmpfile >>= \case
Nothing -> go True Nothing
Just True -> go True (Just tmpfile)
Just False -> do