summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/T4114dSub.hs
blob: 0616a216d2fa12e6810eaac0f28a82a6213efb59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module T4114dSub (assertKeep, assertNoKeep) where

import Control.Monad    (unless, when)
import System.Directory (doesFileExist)

assertNoKeep :: FilePath -> IO ()
assertNoKeep a =
   whenM (doesFileExist a) $
       error ("error: intermediate '" ++ a ++ "' exists")

assertKeep :: FilePath -> IO ()
assertKeep a =
   unlessM (doesFileExist a) $
       error ("error: intermediate '" ++ a ++ "' is missing")

whenM :: Monad m => m Bool -> m () -> m ()
whenM mp f = mp >>= \p -> when p f

unlessM :: Monad m => m Bool -> m () -> m ()
unlessM mp f = mp >>= \p -> unless p f