module Hedgehog.Extras.Test.Concurrent
  ( threadDelay
  ) where

import           Control.Monad.IO.Class (MonadIO)
import           Data.Function (($), (.))
import           Data.Int
import           Hedgehog (MonadTest)

import qualified Control.Concurrent as IO
import qualified GHC.Stack as GHC
import qualified Hedgehog as H

-- Delay the thread by 'n' milliseconds.
threadDelay :: (MonadTest m, MonadIO m) => Int -> m ()
threadDelay :: forall (m :: * -> *). (MonadTest m, MonadIO m) => Int -> m ()
threadDelay Int
n = forall a. HasCallStack => (HasCallStack => a) -> a
GHC.withFrozenCallStack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a.
(MonadTest m, MonadIO m, HasCallStack) =>
IO a -> m a
H.evalIO forall a b. (a -> b) -> a -> b
$ Int -> IO ()
IO.threadDelay Int
n