diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-16 14:49:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-16 14:49:28 -0400 |
commit | 760cde28b67c14e0ad68e8649c0abe0544c44947 (patch) | |
tree | 6d26b4783410f317f18200f66c9031a8d63afba7 | |
parent | 57428c356ea81ea13193ac5dfc32d9a824ed4d65 (diff) |
more pointless monadic golfing
-rw-r--r-- | GitRepo.hs | 3 | ||||
-rw-r--r-- | Locations.hs | 2 | ||||
-rw-r--r-- | Remote/S3real.hs | 2 | ||||
-rw-r--r-- | Utility.hs | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/GitRepo.hs b/GitRepo.hs index 3c5a1e129..87cceece4 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -577,8 +577,7 @@ encodeGitFile s = foldl (++) "\"" (map echar s) ++ "\"" e_num c = showoctal $ ord c -- unicode character is decomposed to -- Word8s and each is shown in octal - e_utf c = concat $ map showoctal $ - (encode [c] :: [Word8]) + e_utf c = showoctal =<< (encode [c] :: [Word8]) {- for quickcheck -} prop_idempotent_deencode :: String -> Bool diff --git a/Locations.hs b/Locations.hs index 1c4f8296e..38a320a2b 100644 --- a/Locations.hs +++ b/Locations.hs @@ -175,7 +175,7 @@ prop_idempotent_fileKey s = Just k == fileKey (keyFile k) hashDirMixed :: Key -> FilePath hashDirMixed k = addTrailingPathSeparator $ take 2 dir </> drop 2 dir where - dir = take 4 $ concat $ map display_32bits_as_dir [a,b,c,d] + dir = take 4 $ display_32bits_as_dir =<< [a,b,c,d] ABCD (a,b,c,d) = md5 $ Str $ show k {- Generates a hash directory that is all lower case. -} diff --git a/Remote/S3real.hs b/Remote/S3real.hs index 135966903..baf570593 100644 --- a/Remote/S3real.hs +++ b/Remote/S3real.hs @@ -232,7 +232,7 @@ bucketKey r bucket k = S3Object bucket (bucketFile r k) "" [] L.empty - with no whitespace. Other characters are xml entity - encoded. -} iaMunge :: String -> String -iaMunge = concat . (map munge) +iaMunge = (>>= munge) where munge c | isAsciiUpper c || isAsciiLower c || isNumber c = [c] diff --git a/Utility.hs b/Utility.hs index 44c8cdd65..6dd7d329c 100644 --- a/Utility.hs +++ b/Utility.hs @@ -59,7 +59,7 @@ data CommandParam = Params String | Param String | File FilePath {- Used to pass a list of CommandParams to a function that runs - a command and expects Strings. -} toCommand :: [CommandParam] -> [String] -toCommand l = concat $ map unwrap l +toCommand = (>>= unwrap) where unwrap (Param s) = [s] unwrap (Params s) = filter (not . null) (split " " s) |