grenade/test/Test/Jack/Compat.hs
Huw Campbell 6c6e706e66 Use a blinded forAll for proxy like generators.
This is a bit ironic, as the Typable constraint only exists for
7.10 printing in hedgehog, but the 7.10 proxies don't have typeable.
2017-04-10 12:37:45 +10:00

23 lines
668 B
Haskell

{-# LANGUAGE RankNTypes #-}
module Test.Jack.Compat where
import Control.Monad.Trans.Class (MonadTrans(..))
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import Hedgehog.Internal.Property ( Test (..) )
type Jack x = forall m. Monad m => Gen m x
(...) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
(...) = (.) . (.)
{-# INLINE (...) #-}
choose :: Integral a => a -> a -> Jack a
choose = Gen.integral ... Range.constant
-- | Generates a random input for the test by running the provided generator.
blindForAll :: Monad m => Gen m a -> Test m a
blindForAll = Test . lift . lift