diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-08 15:34:10 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-08 16:27:20 -0400 |
commit | bf460a0a98d7e4c7f4eac525fcf300629db582b6 (patch) | |
tree | bff7cd09529c40fa8cb76fd92428cc41e24ad808 /Git/Queue.hs | |
parent | 2ff8915365099501382183af9855e739fc234861 (diff) |
reorder repo parameters last
Many functions took the repo as their first parameter. Changing it
consistently to be the last parameter allows doing some useful things with
currying, that reduce boilerplate.
In particular, g <- gitRepo is almost never needed now, instead
use inRepo to run an IO action in the repo, and fromRepo to get
a value from the repo.
This also provides more opportunities to use monadic and applicative
combinators.
Diffstat (limited to 'Git/Queue.hs')
-rw-r--r-- | Git/Queue.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Git/Queue.hs b/Git/Queue.hs index 25b9ffad0..70c766d04 100644 --- a/Git/Queue.hs +++ b/Git/Queue.hs @@ -72,8 +72,8 @@ full :: Queue -> Bool full (Queue n _) = n > maxSize {- Runs a queue on a git repository. -} -flush :: Repo -> Queue -> IO Queue -flush repo (Queue _ m) = do +flush :: Queue -> Repo -> IO Queue +flush (Queue _ m) repo = do forM_ (M.toList m) $ uncurry $ runAction repo return empty @@ -87,6 +87,6 @@ runAction :: Repo -> Action -> [FilePath] -> IO () runAction repo action files = pOpen WriteToPipe "xargs" ("-0":"git":params) feedxargs where - params = toCommand $ gitCommandLine repo - (Param (getSubcommand action):getParams action) + params = toCommand $ gitCommandLine + (Param (getSubcommand action):getParams action) repo feedxargs h = hPutStr h $ join "\0" files |