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 /Locations.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 'Locations.hs')
-rw-r--r-- | Locations.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Locations.hs b/Locations.hs index ceb6246b9..83897f488 100644 --- a/Locations.hs +++ b/Locations.hs @@ -65,8 +65,8 @@ annexLocation key = objectDir </> hashDirMixed key </> f </> f f = keyFile key {- Annexed file's absolute location in a repository. -} -gitAnnexLocation :: Git.Repo -> Key -> FilePath -gitAnnexLocation r key +gitAnnexLocation :: Key -> Git.Repo -> FilePath +gitAnnexLocation key r | Git.repoIsLocalBare r = Git.workTree r </> annexLocation key | otherwise = Git.workTree r </> ".git" </> annexLocation key @@ -88,16 +88,16 @@ gitAnnexTmpDir :: Git.Repo -> FilePath gitAnnexTmpDir r = addTrailingPathSeparator $ gitAnnexDir r </> "tmp" {- The temp file to use for a given key. -} -gitAnnexTmpLocation :: Git.Repo -> Key -> FilePath -gitAnnexTmpLocation r key = gitAnnexTmpDir r </> keyFile key +gitAnnexTmpLocation :: Key -> Git.Repo -> FilePath +gitAnnexTmpLocation key r = gitAnnexTmpDir r </> keyFile key {- .git/annex/bad/ is used for bad files found during fsck -} gitAnnexBadDir :: Git.Repo -> FilePath gitAnnexBadDir r = addTrailingPathSeparator $ gitAnnexDir r </> "bad" {- The bad file to use for a given key. -} -gitAnnexBadLocation :: Git.Repo -> Key -> FilePath -gitAnnexBadLocation r key = gitAnnexBadDir r </> keyFile key +gitAnnexBadLocation :: Key -> Git.Repo -> FilePath +gitAnnexBadLocation key r = gitAnnexBadDir r </> keyFile key {- .git/annex/*unused is used to number possibly unused keys -} gitAnnexUnusedLog :: FilePath -> Git.Repo -> FilePath |