pointlessness
This commit is contained in:
parent
cd0ab91c91
commit
29335bf326
5 changed files with 20 additions and 3 deletions
2
Annex.hs
2
Annex.hs
|
@ -128,7 +128,7 @@ newState gitrepo = AnnexState
|
||||||
{- Makes an Annex state object for the specified git repo.
|
{- Makes an Annex state object for the specified git repo.
|
||||||
- Ensures the config is read, if it was not already. -}
|
- Ensures the config is read, if it was not already. -}
|
||||||
new :: Git.Repo -> IO AnnexState
|
new :: Git.Repo -> IO AnnexState
|
||||||
new gitrepo = newState <$> Git.Config.read gitrepo
|
new = newState <$$> Git.Config.read
|
||||||
|
|
||||||
{- performs an action in the Annex monad -}
|
{- performs an action in the Annex monad -}
|
||||||
run :: AnnexState -> Annex a -> IO (a, AnnexState)
|
run :: AnnexState -> Annex a -> IO (a, AnnexState)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import Utility.SafeCommand as X
|
||||||
import Utility.Path as X
|
import Utility.Path as X
|
||||||
import Utility.Directory as X
|
import Utility.Directory as X
|
||||||
import Utility.Monad as X
|
import Utility.Monad as X
|
||||||
|
import Utility.Applicative as X
|
||||||
import Utility.FileSystemEncoding as X
|
import Utility.FileSystemEncoding as X
|
||||||
|
|
||||||
import Utility.PartialPrelude as X
|
import Utility.PartialPrelude as X
|
||||||
|
|
|
@ -48,7 +48,7 @@ addLog file line = Annex.Branch.change file $ \s ->
|
||||||
{- Reads a log file.
|
{- Reads a log file.
|
||||||
- Note that the LogLines returned may be in any order. -}
|
- Note that the LogLines returned may be in any order. -}
|
||||||
readLog :: FilePath -> Annex [LogLine]
|
readLog :: FilePath -> Annex [LogLine]
|
||||||
readLog file = parseLog <$> Annex.Branch.get file
|
readLog = parseLog <$$> Annex.Branch.get
|
||||||
|
|
||||||
{- Parses a log file. Unparseable lines are ignored. -}
|
{- Parses a log file. Unparseable lines are ignored. -}
|
||||||
parseLog :: String -> [LogLine]
|
parseLog :: String -> [LogLine]
|
||||||
|
|
|
@ -272,7 +272,7 @@ retrieveCheap d _ k f = liftIO $ withStoredFiles Nothing d k go
|
||||||
remove :: FilePath -> ChunkSize -> Key -> Annex Bool
|
remove :: FilePath -> ChunkSize -> Key -> Annex Bool
|
||||||
remove d chunksize k = liftIO $ withStoredFiles chunksize d k go
|
remove d chunksize k = liftIO $ withStoredFiles chunksize d k go
|
||||||
where
|
where
|
||||||
go files = all id <$> mapM removefile files
|
go = all id <$$> mapM removefile
|
||||||
removefile file = catchBoolIO $ do
|
removefile file = catchBoolIO $ do
|
||||||
let dir = parentDir file
|
let dir = parentDir file
|
||||||
allowWrite dir
|
allowWrite dir
|
||||||
|
|
16
Utility/Applicative.hs
Normal file
16
Utility/Applicative.hs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{- applicative stuff
|
||||||
|
-
|
||||||
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
||||||
|
-
|
||||||
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
|
-}
|
||||||
|
|
||||||
|
module Utility.Applicative where
|
||||||
|
|
||||||
|
{- Like <$> , but supports one level of currying.
|
||||||
|
-
|
||||||
|
- foo v = bar <$> action v == foo = bar <$$> action
|
||||||
|
-}
|
||||||
|
(<$$>) :: Functor f => (a -> b) -> (c -> f a) -> c -> f b
|
||||||
|
f <$$> v = fmap f . v
|
||||||
|
infixr 4 <$$>
|
Loading…
Add table
Add a link
Reference in a new issue