more partial function removal

Left a few Prelude.head's in where it was checked not null and too hard to
remove, etc.
This commit is contained in:
Joey Hess 2011-12-15 18:11:42 -04:00
parent b7e0d39abb
commit 95d2391f58
24 changed files with 73 additions and 78 deletions

View file

@ -40,15 +40,10 @@ remoteConfig r key = "remote." ++ fromMaybe "" (Git.remoteName r) ++ ".annex-" +
remoteCost :: Git.Repo -> Int -> Annex Int
remoteCost r def = do
cmd <- getConfig r "cost-command" ""
safeparse <$> if not $ null cmd
(fromMaybe def . readMaybe) <$>
if not $ null cmd
then liftIO $ snd <$> pipeFrom "sh" ["-c", cmd]
else getConfig r "cost" ""
where
safeparse v
| null ws = def
| otherwise = fromMaybe def $ readMaybe $ head ws
where
ws = words v
cheapRemoteCost :: Int
cheapRemoteCost = 100