aboutsummaryrefslogtreecommitdiff
path: root/haddock-test/src/Test/Haddock
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-18 23:42:25 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-08-22 23:40:28 +0200
commit863d33c4d125e13f87193802f6d4faed38da24db (patch)
treea24d4a77b6fd26d8e9469ee00605653c70679ee3 /haddock-test/src/Test/Haddock
parent8e05e0b78eabbaf59c7d2c90d1f839fd58c5fe09 (diff)
Fix bug with unnecessary checking old test output.
Diffstat (limited to 'haddock-test/src/Test/Haddock')
-rw-r--r--haddock-test/src/Test/Haddock/Utils.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/haddock-test/src/Test/Haddock/Utils.hs b/haddock-test/src/Test/Haddock/Utils.hs
index 4640fe97..4f97fa72 100644
--- a/haddock-test/src/Test/Haddock/Utils.hs
+++ b/haddock-test/src/Test/Haddock/Utils.hs
@@ -21,6 +21,10 @@ partitionM p (x:xs) = do
pure $ if b then (x:ss, fs) else (ss, x:fs)
+whenM :: Monad m => m Bool -> m () -> m ()
+whenM mb action = mb >>= \b -> when b action
+
+
getDirectoryTree :: FilePath -> IO [FilePath]
getDirectoryTree path = do
(dirs, files) <- partitionM isDirectory =<< contents
@@ -31,3 +35,9 @@ getDirectoryTree path = do
contents = filter realEntry <$> getDirectoryContents path
isDirectory entry = doesDirectoryExist $ path </> entry
realEntry entry = not $ entry == "." || entry == ".."
+
+
+createEmptyDirectory :: FilePath -> IO ()
+createEmptyDirectory path = do
+ whenM (doesDirectoryExist path) $ removeDirectoryRecursive path
+ createDirectory path