tweak
This commit is contained in:
parent
5ef11350aa
commit
a64c16bf7d
2 changed files with 4 additions and 6 deletions
|
@ -122,8 +122,7 @@ lookupBackendName s = fromMaybe unknown $ maybeLookupBackendName s
|
|||
where
|
||||
unknown = error $ "unknown backend " ++ s
|
||||
maybeLookupBackendName :: String -> Maybe (Backend Annex)
|
||||
maybeLookupBackendName s =
|
||||
if 1 /= length matches
|
||||
then Nothing
|
||||
else Just $ head matches
|
||||
maybeLookupBackendName s
|
||||
| length matches == 1 = Just $ head matches
|
||||
| otherwise = Nothing
|
||||
where matches = filter (\b -> s == B.name b) list
|
||||
|
|
|
@ -137,8 +137,7 @@ compareSizes units abbrev old new
|
|||
{- Parses strings like "10 kilobytes" or "0.5tb". -}
|
||||
readSize :: [Unit] -> String -> Maybe ByteSize
|
||||
readSize units input
|
||||
| null parsednum = Nothing
|
||||
| null parsedunit = Nothing
|
||||
| null parsednum || null parsedunit = Nothing
|
||||
| otherwise = Just $ round $ number * fromIntegral multiplier
|
||||
where
|
||||
(number, rest) = head parsednum
|
||||
|
|
Loading…
Reference in a new issue