diff options
author | 2011-08-25 00:28:55 -0400 | |
---|---|---|
committer | 2011-08-25 01:27:19 -0400 | |
commit | 678726c10c13481c082743808a5188d28567e2b3 (patch) | |
tree | a5052eb5b20444e10d3f5d467281ef4c0f5975d1 /Command | |
parent | 20259c2955e408a72e0960207fc8be4cbeec2e21 (diff) |
code simplification thanks to applicative functors
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Migrate.hs | 3 | ||||
-rw-r--r-- | Command/Status.hs | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs index 25227ae16..6ad7e239c 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -8,6 +8,7 @@ module Command.Migrate where import Control.Monad.State (liftIO) +import Control.Applicative import System.Posix.Files import System.Directory import System.FilePath @@ -39,7 +40,7 @@ start (file, b) = isAnnexed file $ \(key, oldbackend) -> do next $ perform file key newbackend else stop where - choosebackend Nothing = return . head =<< Backend.orderedList + choosebackend Nothing = head <$> Backend.orderedList choosebackend (Just backend) = return backend {- Checks if a key is upgradable to a newer representation. -} diff --git a/Command/Status.hs b/Command/Status.hs index aef4df232..5c82744b1 100644 --- a/Command/Status.hs +++ b/Command/Status.hs @@ -8,6 +8,7 @@ module Command.Status where import Control.Monad.State +import Control.Applicative import Data.Maybe import System.IO import Data.List @@ -112,12 +113,10 @@ total_annex_size = stat "total annex size" $ cachedKeysReferenced >>= keySizeSum local_annex_keys :: Stat -local_annex_keys = stat "local annex keys" $ - return . show . snd =<< cachedKeysPresent +local_annex_keys = stat "local annex keys" $ show . snd <$> cachedKeysPresent total_annex_keys :: Stat -total_annex_keys = stat "total annex keys" $ - return . show . snd =<< cachedKeysReferenced +total_annex_keys = stat "total annex keys" $ show . snd <$> cachedKeysReferenced tmp_size :: Stat tmp_size = staleSize "temporary directory size" gitAnnexTmpDir @@ -126,8 +125,7 @@ bad_data_size :: Stat bad_data_size = staleSize "bad keys size" gitAnnexBadDir backend_usage :: Stat -backend_usage = stat "backend usage" $ - return . usage =<< cachedKeysReferenced +backend_usage = stat "backend usage" $ usage <$> cachedKeysReferenced where usage (ks, _) = pp "" $ sort $ map swap $ splits ks splits :: [Key] -> [(String, Integer)] |