diff options
author | Joey Hess <joey@kitenet.net> | 2011-08-25 00:28:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-08-25 01:27:19 -0400 |
commit | 678726c10c13481c082743808a5188d28567e2b3 (patch) | |
tree | a5052eb5b20444e10d3f5d467281ef4c0f5975d1 /Upgrade | |
parent | 20259c2955e408a72e0960207fc8be4cbeec2e21 (diff) |
code simplification thanks to applicative functors
Diffstat (limited to 'Upgrade')
-rw-r--r-- | Upgrade/V1.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs index b4567a0b7..9c3fd9959 100644 --- a/Upgrade/V1.hs +++ b/Upgrade/V1.hs @@ -11,6 +11,7 @@ import System.IO.Error (try) import System.Directory import Control.Monad.State (liftIO) import Control.Monad (filterM, forM_, unless) +import Control.Applicative import System.Posix.Files import System.FilePath import Data.String.Utils @@ -192,7 +193,7 @@ writeLog1 :: FilePath -> [LogLine] -> IO () writeLog1 file ls = viaTmp writeFile file (unlines $ map show ls) readLog1 :: FilePath -> IO [LogLine] -readLog1 file = catch (return . parseLog =<< readFileStrict file) (const $ return []) +readLog1 file = catch (parseLog <$> readFileStrict file) (const $ return []) lookupFile1 :: FilePath -> Annex (Maybe (Key, Backend Annex)) lookupFile1 file = do @@ -201,7 +202,7 @@ lookupFile1 file = do Left _ -> return Nothing Right l -> makekey l where - getsymlink = return . takeFileName =<< readSymbolicLink file + getsymlink = takeFileName <$> readSymbolicLink file makekey l = case maybeLookupBackendName bname of Nothing -> do unless (null kname || null bname || |