syntax tweaks

Although I hate to lose one of the only places I've ever used the list monad..
This commit is contained in:
Joey Hess 2012-05-02 19:51:41 -04:00
parent 441b138592
commit 32de288c35

View file

@ -36,7 +36,7 @@ configSet u c = do
{- Map of remotes by uuid containing key/value config maps. -} {- Map of remotes by uuid containing key/value config maps. -}
readRemoteLog :: Annex (M.Map UUID RemoteConfig) readRemoteLog :: Annex (M.Map UUID RemoteConfig)
readRemoteLog = (simpleMap . parseLog parseConfig) <$> Annex.Branch.get remoteLog readRemoteLog = simpleMap . parseLog parseConfig <$> Annex.Branch.get remoteLog
parseConfig :: String -> Maybe RemoteConfig parseConfig :: String -> Maybe RemoteConfig
parseConfig = Just . keyValToConfig . words parseConfig = Just . keyValToConfig . words
@ -59,7 +59,7 @@ configToKeyVal m = map toword $ sort $ M.toList m
toword (k, v) = k ++ "=" ++ configEscape v toword (k, v) = k ++ "=" ++ configEscape v
configEscape :: String -> String configEscape :: String -> String
configEscape = (>>= escape) configEscape = concatMap escape
where where
escape c escape c
| isSpace c || c `elem` "&" = "&" ++ show (ord c) ++ ";" | isSpace c || c `elem` "&" = "&" ++ show (ord c) ++ ";"