From 95d2391f58ae240e7100f0d5488dd7246f71f3bb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 15 Dec 2011 18:11:42 -0400 Subject: more partial function removal Left a few Prelude.head's in where it was checked not null and too hard to remove, etc. --- Backend.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Backend.hs') 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 -- cgit v1.2.3