diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-30 12:01:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-30 12:13:34 -0400 |
commit | 1b0edc1ab2f3516dc532b0cf4ea39a0af2f6392f (patch) | |
tree | 2f552619d5f283672c79d405c709661a6046c8ec | |
parent | 96e561bc477bd0a4bbffb769369fabe1e1e1982f (diff) |
idiomatic elem
-rw-r--r-- | Backend/File.hs | 6 | ||||
-rw-r--r-- | BackendTypes.hs | 2 | ||||
-rw-r--r-- | UUID.hs | 4 | ||||
-rw-r--r-- | git-annex-shell.hs | 4 | ||||
-rw-r--r-- | test.hs | 4 |
5 files changed, 10 insertions, 10 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index 68dd4db27..d76cd2939 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -108,7 +108,7 @@ checkRemoveKey key numcopiesM = do | length have >= need = return True | otherwise = do u <- getUUID r - let dup = elem u have + let dup = u `elem` have haskey <- Remotes.inAnnex r key case (dup, haskey) of (False, Right True) -> findcopies need (u:have) rs bad @@ -139,7 +139,7 @@ showLocations key exclude = do ppuuidsskipped <- prettyPrintUUIDs uuidsskipped showLongNote $ message ppuuidswanted ppuuidsskipped where - filteruuids list x = filter (\l -> not $ elem l x) list + filteruuids list x = filter (`notElem` x) list message [] [] = "No other repository is known to contain the file." message rs [] = "Try making some of these repositories available:\n" ++ rs message [] us = "Also these untrusted repositories may contain the file:\n" ++ us @@ -179,7 +179,7 @@ checkKeyNumCopies key file numcopies = do locations <- liftIO $ keyLocations g key untrusted <- trustGet UnTrusted let untrustedlocations = intersect untrusted locations - let safelocations = filter (\l -> not $ l `elem` untrusted) locations + let safelocations = filter (`notElem` untrusted) locations let present = length safelocations if present < needed then do diff --git a/BackendTypes.hs b/BackendTypes.hs index fd4a61b98..c4927ab20 100644 --- a/BackendTypes.hs +++ b/BackendTypes.hs @@ -75,5 +75,5 @@ instance Arbitrary Key where prop_idempotent_key_read_show :: Key -> Bool prop_idempotent_key_read_show k -- backend names will never contain colons - | elem ':' (backendName k) = True + | ':' `elem` (backendName k) = True | otherwise = k == (read $ show k) @@ -88,7 +88,7 @@ reposByUUID repos uuids = filterM match repos where match r = do u <- getUUID r - return $ elem u uuids + return $ u `elem` uuids {- Filters a list of repos to ones that do not have the listed UUIDs. -} reposWithoutUUID :: [Git.Repo] -> [UUID] -> Annex [Git.Repo] @@ -96,7 +96,7 @@ reposWithoutUUID repos uuids = filterM unmatch repos where unmatch r = do u <- getUUID r - return $ not $ elem u uuids + return $ u `notElem` uuids {- Pretty-prints a list of UUIDs -} prettyPrintUUIDs :: [UUID] -> Annex String diff --git a/git-annex-shell.hs b/git-annex-shell.hs index fa2a7f606..fee4091ef 100644 --- a/git-annex-shell.hs +++ b/git-annex-shell.hs @@ -46,13 +46,13 @@ main' [] = failure main' ("-c":p) = main' p -- a command can be either a builtin or something to pass to git-shell main' c@(cmd:dir:params) - | elem cmd builtins = builtin cmd dir params + | cmd `elem` builtins = builtin cmd dir params | otherwise = external c main' c@(cmd:_) -- Handle the case of being the user's login shell. It will be passed -- a single string containing all the real parameters. | "git-annex-shell " `isPrefixOf` cmd = main' $ drop 1 $ shellUnEscape cmd - | elem cmd builtins = failure + | cmd `elem` builtins = failure | otherwise = external c builtins :: [String] @@ -331,7 +331,7 @@ test_trust = "git-annex trust/untrust/semitrust" ~: intmpclonerepo $ do l <- Trust.trustGet expected r <- Remotes.byName repo u <- UUID.getUUID r - return $ elem u l + return $ u `elem` l assertBool msg present repo = "origin" @@ -588,7 +588,7 @@ checklocationlog f expected = do g <- Annex.gitRepo liftIO $ LocationLog.keyLocations g k assertEqual ("bad content in location log for " ++ f ++ " key " ++ (show k) ++ " uuid " ++ thisuuid) - expected (elem thisuuid uuids) + expected (thisuuid `elem` uuids) -- Location log files should always be checked -- into git, and any modifications staged for |