diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-12-05 15:00:50 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-12-05 15:00:50 -0400 |
commit | 236c467da19f34edb08f124e37fd26eb62c43fcf (patch) | |
tree | f4e488f77fb954812e4d48f399fc2ecab072afea /Annex/WorkTree.hs | |
parent | f013f71cb5d3f7eee3afb3eb8f01a33206d717c4 (diff) |
more lambda-case conversion
Diffstat (limited to 'Annex/WorkTree.hs')
-rw-r--r-- | Annex/WorkTree.hs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/Annex/WorkTree.hs b/Annex/WorkTree.hs index d62e15aee..4496561c9 100644 --- a/Annex/WorkTree.hs +++ b/Annex/WorkTree.hs @@ -30,17 +30,15 @@ import qualified Database.Keys.SQL - looking for a pointer to a key in git. -} lookupFile :: FilePath -> Annex (Maybe Key) -lookupFile file = do - mkey <- isAnnexLink file - case mkey of - Just key -> makeret key - Nothing -> ifM (versionSupportsUnlockedPointers <||> isDirect) - ( ifM (liftIO $ doesFileExist file) - ( maybe (return Nothing) makeret =<< catKeyFile file - , return Nothing - ) - , return Nothing +lookupFile file = isAnnexLink file >>= \case + Just key -> makeret key + Nothing -> ifM (versionSupportsUnlockedPointers <||> isDirect) + ( ifM (liftIO $ doesFileExist file) + ( maybe (return Nothing) makeret =<< catKeyFile file + , return Nothing ) + , return Nothing + ) where makeret = return . Just @@ -84,9 +82,8 @@ scanUnlockedFiles = whenM (isJust <$> inRepo Git.Branch.current) $ do whenM (inAnnex k) $ do f <- fromRepo $ fromTopFilePath tf destmode <- liftIO $ catchMaybeIO $ fileMode <$> getFileStatus f - replaceFile f $ \tmp -> do - r <- linkFromAnnex k tmp destmode - case r of + replaceFile f $ \tmp -> + linkFromAnnex k tmp destmode >>= \case LinkAnnexOk -> return () LinkAnnexNoop -> return () LinkAnnexFailed -> liftIO $ |