From 678726c10c13481c082743808a5188d28567e2b3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 25 Aug 2011 00:28:55 -0400 Subject: code simplification thanks to applicative functors --- Config.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Config.hs') diff --git a/Config.hs b/Config.hs index 12f648047..b4f4c0b92 100644 --- a/Config.hs +++ b/Config.hs @@ -9,7 +9,7 @@ module Config where import Data.Maybe import Control.Monad.State (liftIO) -import Control.Monad (liftM) +import Control.Applicative import System.Cmd.Utils import qualified Git @@ -47,8 +47,8 @@ remoteConfig r key = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex remoteCost :: Git.Repo -> Int -> Annex Int remoteCost r def = do cmd <- getConfig r "cost-command" "" - return . safeparse =<< if not $ null cmd - then liftM snd $ liftIO $ pipeFrom "sh" ["-c", cmd] + safeparse <$> if not $ null cmd + then liftIO $ snd <$> pipeFrom "sh" ["-c", cmd] else getConfig r "cost" "" where safeparse v -- cgit v1.2.3