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 /Branch.hs | |
parent | 20259c2955e408a72e0960207fc8be4cbeec2e21 (diff) |
code simplification thanks to applicative functors
Diffstat (limited to 'Branch.hs')
-rw-r--r-- | Branch.hs | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -20,6 +20,7 @@ module Branch ( import Control.Monad (when, unless, liftM) import Control.Monad.State (liftIO) +import Control.Applicative ((<$>)) import System.FilePath import System.Directory import Data.String.Utils @@ -158,7 +159,7 @@ update = do staged <- stageJournalFiles refs <- siblingBranches - updated <- catMaybes `liftM` mapM updateRef refs + updated <- catMaybes <$> mapM updateRef refs g <- Annex.gitRepo unless (null updated && not staged) $ liftIO $ Git.commit g "update" fullname (fullname:updated) @@ -182,7 +183,7 @@ hasOrigin = refExists originname {- Does the git-annex branch or a foo/git-annex branch exist? -} hasSomeBranch :: Annex Bool -hasSomeBranch = liftM (not . null) siblingBranches +hasSomeBranch = not . null <$> siblingBranches {- List of all git-annex branches, including the main one and any - from remotes. -} @@ -323,7 +324,7 @@ getJournalFile file = do {- List of journal files. -} getJournalFiles :: Annex [FilePath] -getJournalFiles = liftM (map fileJournal) getJournalFilesRaw +getJournalFiles = map fileJournal <$> getJournalFilesRaw getJournalFilesRaw :: Annex [FilePath] getJournalFilesRaw = do |