summaryrefslogtreecommitdiff
path: root/Backend.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-15 18:11:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-15 18:19:36 -0400
commit95d2391f58ae240e7100f0d5488dd7246f71f3bb (patch)
treef33f21904ae7be4d40b70bab1e2a68fd4eef5526 /Backend.hs
parentb7e0d39abbc9a09c21c6f0103ad6c9f4547f81fe (diff)
more partial function removal
Left a few Prelude.head's in where it was checked not null and too hard to remove, etc.
Diffstat (limited to 'Backend.hs')
-rw-r--r--Backend.hs6
1 files changed, 2 insertions, 4 deletions
diff --git a/Backend.hs b/Backend.hs
index 4743bb202..2f788fcd0 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -107,7 +107,7 @@ chooseBackends fs = Annex.getState Annex.forcebackend >>= go
return $ map (\(f,b) -> (maybeLookupBackendName b, f)) pairs
go (Just _) = do
l <- orderedList
- return $ map (\f -> (Just $ head l, f)) fs
+ return $ map (\f -> (Just $ Prelude.head l, f)) fs
{- Looks up a backend by name. May fail if unknown. -}
lookupBackendName :: String -> Backend Annex
@@ -115,8 +115,6 @@ lookupBackendName s = fromMaybe unknown $ maybeLookupBackendName s
where
unknown = error $ "unknown backend " ++ s
maybeLookupBackendName :: String -> Maybe (Backend Annex)
-maybeLookupBackendName s
- | length matches == 1 = Just $ head matches
- | otherwise = Nothing
+maybeLookupBackendName s = headMaybe matches
where
matches = filter (\b -> s == B.name b) list