module Hedgehog.Main (
  -- * Running tests
    defaultMain
  ) where

import           Control.Monad (unless)

import           System.Exit (exitFailure)
import           System.IO (BufferMode (LineBuffering), hSetBuffering, stderr, stdout)

-- | An entry point that can be used as a main function.
--
defaultMain :: [IO Bool] -> IO ()
defaultMain :: [IO Bool] -> IO ()
defaultMain [IO Bool]
tests = do
  Handle -> BufferMode -> IO ()
hSetBuffering Handle
stdout BufferMode
LineBuffering
  Handle -> BufferMode -> IO ()
hSetBuffering Handle
stderr BufferMode
LineBuffering
  Bool
result <- forall (t :: * -> *). Foldable t => t Bool -> Bool
and forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [IO Bool]
tests
  forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless Bool
result
    forall a. IO a
exitFailure