{-# LANGUAGE RankNTypes #-}
module Ouroboros.Network.Testing.QuickCheck
( runSimGen
, monadicSim
) where
import Test.QuickCheck
import Test.QuickCheck.Gen.Unsafe (Capture (..), capture)
import Test.QuickCheck.Monadic
import Control.Monad.IOSim
runSimGen :: (forall s. Gen (IOSim s a)) -> Gen a
runSimGen :: forall a. (forall s. Gen (IOSim s a)) -> Gen a
runSimGen forall s. Gen (IOSim s a)
f = do
Capture eval <- Gen Capture
capture
return $ runSimOrThrow (eval f)
monadicSim :: Testable a => (forall s. PropertyM (IOSim s) a) -> Property
monadicSim :: forall a.
Testable a =>
(forall s. PropertyM (IOSim s) a) -> Property
monadicSim forall s. PropertyM (IOSim s) a
m = Gen Property -> Property
forall prop. Testable prop => prop -> Property
property ((forall s. Gen (IOSim s Property)) -> Gen Property
forall a. (forall s. Gen (IOSim s a)) -> Gen a
runSimGen (PropertyM (IOSim s) a -> Gen (IOSim s Property)
forall a (m :: * -> *).
(Testable a, Monad m) =>
PropertyM m a -> Gen (m Property)
monadic' PropertyM (IOSim s) a
forall s. PropertyM (IOSim s) a
m))