From 01c701b5a5c18cfa952394ae1cbd2249cfd08f51 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 3 Feb 2016 13:23:34 -0400 Subject: simplify --- Annex/FileMatcher.hs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Annex/FileMatcher.hs') diff --git a/Annex/FileMatcher.hs b/Annex/FileMatcher.hs index 641fe49c9..e3482ec8b 100644 --- a/Annex/FileMatcher.hs +++ b/Annex/FileMatcher.hs @@ -71,33 +71,33 @@ exprParser matchstandard matchgroupwanted getgroupmap configmap mu expr = preferreddir = fromMaybe "public" $ M.lookup "preferreddir" =<< (`M.lookup` configmap) =<< mu -parseToken :: FileMatcher Annex -> FileMatcher Annex -> MkLimit Annex -> MkLimit Annex -> Annex GroupMap -> String -> Either String (Token (MatchFiles Annex)) +parseToken :: FileMatcher Annex -> FileMatcher Annex -> MatchFiles Annex -> MatchFiles Annex -> Annex GroupMap -> String -> Either String (Token (MatchFiles Annex)) parseToken matchstandard matchgroupwanted checkpresent checkpreferreddir getgroupmap t | t `elem` tokens = Right $ token t | otherwise = case t of "standard" -> call matchstandard "groupwanted" -> call matchgroupwanted - "present" -> use checkpresent - "inpreferreddir" -> use checkpreferreddir + "present" -> simply checkpresent + "inpreferreddir" -> simply checkpreferreddir "unused" -> simply limitUnused "anything" -> simply limitAnything "nothing" -> simply limitNothing _ -> case k of - "include" -> use limitInclude - "exclude" -> use limitExclude - "copies" -> use limitCopies - "lackingcopies" -> use $ limitLackingCopies False - "approxlackingcopies" -> use $ limitLackingCopies True - "inbackend" -> use limitInBackend - "largerthan" -> use $ limitSize (>) - "smallerthan" -> use $ limitSize (<) - "metadata" -> use limitMetaData - "inallgroup" -> use $ limitInAllGroup getgroupmap + "include" -> usev limitInclude + "exclude" -> usev limitExclude + "copies" -> usev limitCopies + "lackingcopies" -> usev $ limitLackingCopies False + "approxlackingcopies" -> usev $ limitLackingCopies True + "inbackend" -> usev limitInBackend + "largerthan" -> usev $ limitSize (>) + "smallerthan" -> usev $ limitSize (<) + "metadata" -> usev limitMetaData + "inallgroup" -> usev $ limitInAllGroup getgroupmap _ -> Left $ "near " ++ show t where (k, v) = separate (== '=') t simply = Right . Operation - use a = Operation <$> a v + usev a = Operation <$> a v call sub = Right $ Operation $ \notpresent mi -> matchMrun sub $ \a -> a notpresent mi -- cgit v1.2.3