module Hedgehog.Gen.QuickCheck (
arbitrary
, quickcheck
) where
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import qualified Test.QuickCheck as QuickCheck
import qualified Test.QuickCheck.Gen as QuickCheck
import qualified Test.QuickCheck.Random as QuickCheck
seedQCGen :: MonadGen m => m QuickCheck.QCGen
seedQCGen =
QuickCheck.mkQCGen <$> fromGenT (Gen.integral_ Range.constantBounded)
quickcheck :: MonadGen m => QuickCheck.Gen a -> m a
quickcheck (QuickCheck.MkGen gen) =
Gen.sized $ \size -> do
qcg <- seedQCGen
pure $
gen qcg (fromIntegral size)
arbitrary :: (QuickCheck.Arbitrary a, MonadGen m) => m a
arbitrary =
Gen.shrink QuickCheck.shrink $
quickcheck QuickCheck.arbitrary