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 /Remote/Directory.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 'Remote/Directory.hs')
-rw-r--r-- | Remote/Directory.hs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs index e8cf05a0e..8e306e228 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -70,15 +70,13 @@ dirKey d k = d </> hashDirMixed k </> f </> f store :: FilePath -> Key -> Annex Bool store d k = do - g <- gitRepo - let src = gitAnnexLocation g k + src <- fromRepo $ gitAnnexLocation k let dest = dirKey d k liftIO $ catchBool $ storeHelper dest $ copyFileExternal src dest storeEncrypted :: FilePath -> (Cipher, Key) -> Key -> Annex Bool storeEncrypted d (cipher, enck) k = do - g <- gitRepo - let src = gitAnnexLocation g k + src <- fromRepo $ gitAnnexLocation k let dest = dirKey d enck liftIO $ catchBool $ storeHelper dest $ encrypt src dest where |