summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-04-21 23:04:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-04-21 23:06:19 -0400
commitbee420bd2d0cbe16489b061b208083e2b8ba9d0e (patch)
tree70ef95f81ee411513da4b6343720480cd941c42c
parentbe36aaca5bccecdff7e48b020ee62b0db3bc38f1 (diff)
in which I discover void
void :: Functor f => f a -> f () -- ah, of course that's useful :)
-rw-r--r--Annex/Branch.hs9
-rw-r--r--Annex/Ssh.hs11
-rw-r--r--Remote/Git.hs6
-rw-r--r--Remote/Helper/Hooks.hs5
-rw-r--r--Utility/FileMode.hs4
-rw-r--r--Utility/Inotify.hs10
6 files changed, 16 insertions, 29 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index e5976c2c0..ce1dd58ce 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -65,9 +65,7 @@ siblingBranches = inRepo $ Git.Ref.matchingUniq name
{- Creates the branch, if it does not already exist. -}
create :: Annex ()
-create = do
- _ <- getBranch
- return ()
+create = void $ getBranch
{- Returns the ref of the branch, creating it first if necessary. -}
getBranch :: Annex Git.Ref
@@ -325,10 +323,9 @@ setUnCommitted = do
liftIO $ writeFile file "1"
setCommitted :: Annex ()
-setCommitted = do
+setCommitted = void $ do
file <- fromRepo gitAnnexIndexDirty
- _ <- liftIO $ tryIO $ removeFile file
- return ()
+ liftIO $ tryIO $ removeFile file
{- Stages the journal into the index. -}
stageJournal :: Annex ()
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index c9e6e2951..02a1ee705 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -87,20 +87,17 @@ sshCleanup = do
stopssh socketfile = do
let (host, port) = socket2hostport socketfile
(_, params) <- sshInfo (host, port)
- _ <- liftIO $ do
+ void $ liftIO $ do
-- "ssh -O stop" is noisy on stderr even with -q
let cmd = unwords $ toCommand $
[ Params "-O stop"
] ++ params ++ [Param host]
- _ <- boolSystem "sh"
+ boolSystem "sh"
[ Param "-c"
, Param $ "ssh " ++ cmd ++ " >/dev/null 2>/dev/null"
]
- --try $ removeFile socketfile
- return ()
- -- Cannot remove the lock file; other processes may
- -- be waiting on our exclusive lock to use it.
- return ()
+ -- Cannot remove the lock file; other processes may
+ -- be waiting on our exclusive lock to use it.
hostport2socket :: String -> Maybe Integer -> FilePath
hostport2socket host Nothing = host
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 541b05099..d71872b27 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -313,7 +313,7 @@ commitOnCleanup r a = go `after` a
cleanup
| not $ Git.repoIsUrl r = liftIO $ onLocal r $
Annex.Branch.commit "update"
- | otherwise = do
+ | otherwise = void $ do
Just (shellcmd, shellparams) <-
git_annex_shell r "commit" []
-- Throw away stderr, since the remote may not
@@ -322,6 +322,4 @@ commitOnCleanup r a = go `after` a
let cmd = shellcmd ++ " "
++ unwords (map shellEscape $ toCommand shellparams)
++ ">/dev/null 2>/dev/null"
- _ <- liftIO $
- boolSystem "sh" [Param "-c", Param cmd]
- return ()
+ liftIO $ boolSystem "sh" [Param "-c", Param cmd]
diff --git a/Remote/Helper/Hooks.hs b/Remote/Helper/Hooks.hs
index de731bd6e..40484b2a7 100644
--- a/Remote/Helper/Hooks.hs
+++ b/Remote/Helper/Hooks.hs
@@ -47,9 +47,8 @@ runHooks r starthook stophook a = do
where
remoteid = show (uuid r)
run Nothing = return ()
- run (Just command) = liftIO $ do
- _ <- boolSystem "sh" [Param "-c", Param command]
- return ()
+ run (Just command) = void $ liftIO $
+ boolSystem "sh" [Param "-c", Param command]
firstrun lck = do
-- Take a shared lock; This indicates that git-annex
-- is using the remote, and prevents other instances
diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs
index c0f2ad589..353de7b92 100644
--- a/Utility/FileMode.hs
+++ b/Utility/FileMode.hs
@@ -15,9 +15,7 @@ import Foreign (complement)
{- Applies a conversion function to a file's mode. -}
modifyFileMode :: FilePath -> (FileMode -> FileMode) -> IO ()
-modifyFileMode f convert = do
- _ <- modifyFileMode' f convert
- return ()
+modifyFileMode f convert = void $ modifyFileMode' f convert
modifyFileMode' :: FilePath -> (FileMode -> FileMode) -> IO FileMode
modifyFileMode' f convert = do
s <- getFileStatus f
diff --git a/Utility/Inotify.hs b/Utility/Inotify.hs
index 049737c08..0a261ecfe 100644
--- a/Utility/Inotify.hs
+++ b/Utility/Inotify.hs
@@ -53,10 +53,9 @@ watchDir i test add del dir = watchDir' False i test add del dir
watchDir' :: Bool -> INotify -> (FilePath -> Bool) -> Maybe (FilePath -> IO ()) -> Maybe (FilePath -> IO ()) -> FilePath -> IO ()
watchDir' scan i test add del dir = do
if test dir
- then do
+ then void $ do
_ <- addWatch i watchevents dir go
- _ <- mapM walk =<< dirContents dir
- return ()
+ mapM walk =<< dirContents dir
else return ()
where
watchevents
@@ -92,6 +91,5 @@ waitForTermination = do
check keyboardSignal mv
takeMVar mv
where
- check sig mv = do
- _ <- installHandler sig (CatchOnce $ putMVar mv ()) Nothing
- return ()
+ check sig mv = void $
+ installHandler sig (CatchOnce $ putMVar mv ()) Nothing