in which I discover void

void :: Functor f => f a -> f () -- ah, of course that's useful :)
This commit is contained in:
Joey Hess 2012-04-21 23:04:59 -04:00
parent be36aaca5b
commit bee420bd2d
6 changed files with 16 additions and 29 deletions

View file

@ -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

View file

@ -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