hedgehog-1.1.1: Release with confidence.
Safe HaskellNone
LanguageHaskell2010

Hedgehog

Description

This module includes almost everything you need to get started writing property tests with Hedgehog.

It is designed to be used alongside Hedgehog.Gen and Hedgehog.Range, which should be imported qualified. You also need to enable Template Haskell so the Hedgehog test runner can find your properties.

{-# LANGUAGE TemplateHaskell #-}

import           Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range

Once you have your imports set up, you can write a simple property:

prop_reverse :: Property
prop_reverse =
  property $ do
    xs <- forAll $ Gen.list (Range.linear 0 100) Gen.alpha
    reverse (reverse xs) === xs

And add the Template Haskell splice which will discover your properties:

tests :: IO Bool
tests =
  checkParallel $$(discover)

If you prefer to avoid macros, you can specify the group of properties to run manually instead:

{-# LANGUAGE OverloadedStrings #-}

tests :: IO Bool
tests =
  checkParallel $ Group "Test.Example" [
      ("prop_reverse", prop_reverse)
    ]

You can then load the module in GHCi, and run it:

λ tests
━━━ Test.Example ━━━
  ✓ prop_reverse passed 100 tests.
Synopsis

Properties

data Property Source #

A property test, along with some configurable limits like how many times to run the test.

data PropertyT m a Source #

The property monad transformer allows both the generation of test inputs and the assertion of expectations.

Instances

Instances details
MonadTrans PropertyT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

lift :: Monad m => m a -> PropertyT m a #

MonadTransDistributive PropertyT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type Transformer f PropertyT m Source #

Methods

distributeT :: forall f (m :: Type -> Type) a. Transformer f PropertyT m => PropertyT (f m) a -> f (PropertyT m) a Source #

MonadBase b m => MonadBase b (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftBase :: b α -> PropertyT m α #

MonadBaseControl b m => MonadBaseControl b (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type StM (PropertyT m) a #

Methods

liftBaseWith :: (RunInBase (PropertyT m) b -> b a) -> PropertyT m a #

restoreM :: StM (PropertyT m) a -> PropertyT m a #

MonadState s m => MonadState s (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

get :: PropertyT m s #

put :: s -> PropertyT m () #

state :: (s -> (a, s)) -> PropertyT m a #

MonadReader r m => MonadReader r (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

ask :: PropertyT m r #

local :: (r -> r) -> PropertyT m a -> PropertyT m a #

reader :: (r -> a) -> PropertyT m a #

MonadError e m => MonadError e (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwError :: e -> PropertyT m a #

catchError :: PropertyT m a -> (e -> PropertyT m a) -> PropertyT m a #

Monad m => Monad (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

(>>=) :: PropertyT m a -> (a -> PropertyT m b) -> PropertyT m b #

(>>) :: PropertyT m a -> PropertyT m b -> PropertyT m b #

return :: a -> PropertyT m a #

Functor m => Functor (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

fmap :: (a -> b) -> PropertyT m a -> PropertyT m b #

(<$) :: a -> PropertyT m b -> PropertyT m a #

Monad m => MonadFail (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

fail :: String -> PropertyT m a #

Monad m => Applicative (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

pure :: a -> PropertyT m a #

(<*>) :: PropertyT m (a -> b) -> PropertyT m a -> PropertyT m b #

liftA2 :: (a -> b -> c) -> PropertyT m a -> PropertyT m b -> PropertyT m c #

(*>) :: PropertyT m a -> PropertyT m b -> PropertyT m b #

(<*) :: PropertyT m a -> PropertyT m b -> PropertyT m a #

MonadPlus m => Alternative (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

empty :: PropertyT m a #

(<|>) :: PropertyT m a -> PropertyT m a -> PropertyT m a #

some :: PropertyT m a -> PropertyT m [a] #

many :: PropertyT m a -> PropertyT m [a] #

MonadIO m => MonadIO (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftIO :: IO a -> PropertyT m a #

MonadPlus m => MonadPlus (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

mzero :: PropertyT m a #

mplus :: PropertyT m a -> PropertyT m a -> PropertyT m a #

MonadCatch m => MonadCatch (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

catch :: Exception e => PropertyT m a -> (e -> PropertyT m a) -> PropertyT m a #

MonadThrow m => MonadThrow (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwM :: Exception e => e -> PropertyT m a #

PrimMonad m => PrimMonad (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type PrimState (PropertyT m) #

Methods

primitive :: (State# (PrimState (PropertyT m)) -> (# State# (PrimState (PropertyT m)), a #)) -> PropertyT m a #

MonadResource m => MonadResource (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftResourceT :: ResourceT IO a -> PropertyT m a #

Monad m => MonadTest (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> PropertyT m a Source #

MFunctor PropertyT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> PropertyT m b -> PropertyT n b #

type Transformer t PropertyT m Source # 
Instance details

Defined in Hedgehog.Internal.Property

type PrimState (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

type StM (PropertyT m) a Source # 
Instance details

Defined in Hedgehog.Internal.Property

type StM (PropertyT m) a = StM (TestT (GenT m)) a

data Group Source #

A named collection of property tests.

Constructors

Group 

data PropertyName Source #

The name of a property.

Should be constructed using OverloadedStrings:

  "apples" :: PropertyName

data GroupName Source #

The name of a group of properties.

Should be constructed using OverloadedStrings:

  "fruit" :: GroupName

property :: HasCallStack => PropertyT IO () -> Property Source #

Creates a property with the default configuration.

test :: Monad m => TestT m a -> PropertyT m a Source #

Lift a test in to a property.

Because both TestT and PropertyT have MonadTest instances, this function is not often required. It can however be useful for writing functions directly in TestT and thus gaining a MonadTransControl instance at the expense of not being able to generate additional inputs using forAll.

An example where this is useful is parallel state machine testing, as executeParallel requires MonadBaseControl IO in order to be able to spawn threads in MonadTest.

forAll :: (Monad m, Show a, HasCallStack) => Gen a -> PropertyT m a Source #

Generates a random input for the test by running the provided generator.

forAllWith :: (Monad m, HasCallStack) => (a -> String) -> Gen a -> PropertyT m a Source #

Generates a random input for the test by running the provided generator.

This is a the same as forAll but allows the user to provide a custom rendering function. This is useful for values which don't have a Show instance.

discard :: Monad m => PropertyT m a Source #

Discards the current test entirely.

check :: MonadIO m => Property -> m Bool Source #

Check a property.

recheck :: MonadIO m => Size -> Seed -> Property -> m () Source #

Check a property using a specific size and seed.

discover :: TExpQ Group Source #

Discover all the properties in a module.

Functions starting with prop_ are assumed to be properties.

checkParallel :: MonadIO m => Group -> m Bool Source #

Check a group of properties in parallel.

Warning: although this check function runs tests faster than checkSequential, it should be noted that it may cause problems with properties that are not self-contained. For example, if you have a group of tests which all use the same database table, you may find that they interfere with each other when being run in parallel.

Using Template Haskell for property discovery:

tests :: IO Bool
tests =
  checkParallel $$(discover)

With manually specified properties:

tests :: IO Bool
tests =
  checkParallel $ Group "Test.Example" [
      ("prop_reverse", prop_reverse)
    ]

checkSequential :: MonadIO m => Group -> m Bool Source #

Check a group of properties sequentially.

Using Template Haskell for property discovery:

tests :: IO Bool
tests =
  checkSequential $$(discover)

With manually specified properties:

tests :: IO Bool
tests =
  checkSequential $ Group "Test.Example" [
      ("prop_reverse", prop_reverse)
    ]

data Confidence Source #

The acceptable occurrence of false positives

Example, Confidence 10^9 would mean that you'd accept a false positive for 1 in 10^9 tests.

withConfidence :: Confidence -> Property -> Property Source #

Make sure that the result is statistically significant in accordance to the passed Confidence

withTests :: TestLimit -> Property -> Property Source #

Set the number of times a property should be executed before it is considered successful.

If you have a test that does not involve any generators and thus does not need to run repeatedly, you can use withTests 1 to define a property that will only be checked once.

data TestLimit Source #

The number of successful tests that need to be run before a property test is considered successful.

Can be constructed using numeric literals:

  200 :: TestLimit

Instances

Instances details
Enum TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Eq TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Integral TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Num TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Ord TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Real TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Show TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Lift TestLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

withDiscards :: DiscardLimit -> Property -> Property Source #

Set the number of times a property is allowed to discard before the test runner gives up.

data DiscardLimit Source #

The number of discards to allow before giving up.

Can be constructed using numeric literals:

  10000 :: DiscardLimit

Instances

Instances details
Enum DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Eq DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Integral DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Num DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Ord DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Real DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Show DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Lift DiscardLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

withShrinks :: ShrinkLimit -> Property -> Property Source #

Set the number of times a property is allowed to shrink before the test runner gives up and prints the counterexample.

data ShrinkLimit Source #

The number of shrinks to try before giving up on shrinking.

Can be constructed using numeric literals:

  1000 :: ShrinkLimit

Instances

Instances details
Enum ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Eq ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Integral ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Num ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Ord ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Real ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Show ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

Lift ShrinkLimit Source # 
Instance details

Defined in Hedgehog.Internal.Property

withRetries :: ShrinkRetries -> Property -> Property Source #

Set the number of times a property will be executed for each shrink before the test runner gives up and tries a different shrink. See ShrinkRetries for more information.

data ShrinkRetries Source #

The number of times to re-run a test during shrinking. This is useful if you are testing something which fails non-deterministically and you want to increase the change of getting a good shrink.

If you are doing parallel state machine testing, you should probably set shrink retries to something like 10. This will mean that during shrinking, a parallel test case requires 10 successful runs before it is passes and we try a different shrink.

Can be constructed using numeric literals:

  0 :: ShrinkRetries

Instances

Instances details
Enum ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Eq ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Integral ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Num ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Ord ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Real ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Show ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Lift ShrinkRetries Source # 
Instance details

Defined in Hedgehog.Internal.Property

Generating Test Data

type Gen = GenT Identity Source #

Generator for random values of a.

data GenT m a Source #

Monad transformer which can generate random values of a.

Instances

Instances details
MMonad GenT Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

embed :: forall (n :: Type -> Type) m b. Monad n => (forall a. m a -> GenT n a) -> GenT m b -> GenT n b #

MonadTrans GenT Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

lift :: Monad m => m a -> GenT m a #

MonadTransDistributive GenT Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type Transformer f GenT m Source #

Methods

distributeT :: forall f (m :: Type -> Type) a. Transformer f GenT m => GenT (f m) a -> f (GenT m) a Source #

MonadBase b m => MonadBase b (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

liftBase :: b α -> GenT m α #

MonadBaseControl b m => MonadBaseControl b (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type StM (GenT m) a #

Methods

liftBaseWith :: (RunInBase (GenT m) b -> b a) -> GenT m a #

restoreM :: StM (GenT m) a -> GenT m a #

MonadWriter w m => MonadWriter w (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

writer :: (a, w) -> GenT m a #

tell :: w -> GenT m () #

listen :: GenT m a -> GenT m (a, w) #

pass :: GenT m (a, w -> w) -> GenT m a #

MonadState s m => MonadState s (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

get :: GenT m s #

put :: s -> GenT m () #

state :: (s -> (a, s)) -> GenT m a #

MonadReader r m => MonadReader r (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

ask :: GenT m r #

local :: (r -> r) -> GenT m a -> GenT m a #

reader :: (r -> a) -> GenT m a #

MonadError e m => MonadError e (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

throwError :: e -> GenT m a #

catchError :: GenT m a -> (e -> GenT m a) -> GenT m a #

Monad m => Monad (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

(>>=) :: GenT m a -> (a -> GenT m b) -> GenT m b #

(>>) :: GenT m a -> GenT m b -> GenT m b #

return :: a -> GenT m a #

Functor m => Functor (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

fmap :: (a -> b) -> GenT m a -> GenT m b #

(<$) :: a -> GenT m b -> GenT m a #

Monad m => MonadFail (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

fail :: String -> GenT m a #

Monad m => Applicative (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

pure :: a -> GenT m a #

(<*>) :: GenT m (a -> b) -> GenT m a -> GenT m b #

liftA2 :: (a -> b -> c) -> GenT m a -> GenT m b -> GenT m c #

(*>) :: GenT m a -> GenT m b -> GenT m b #

(<*) :: GenT m a -> GenT m b -> GenT m a #

Monad m => Alternative (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

empty :: GenT m a #

(<|>) :: GenT m a -> GenT m a -> GenT m a #

some :: GenT m a -> GenT m [a] #

many :: GenT m a -> GenT m [a] #

MonadIO m => MonadIO (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

liftIO :: IO a -> GenT m a #

Monad m => MonadPlus (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

mzero :: GenT m a #

mplus :: GenT m a -> GenT m a -> GenT m a #

MonadCatch m => MonadCatch (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

catch :: Exception e => GenT m a -> (e -> GenT m a) -> GenT m a #

MonadThrow m => MonadThrow (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

throwM :: Exception e => e -> GenT m a #

PrimMonad m => PrimMonad (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type PrimState (GenT m) #

Methods

primitive :: (State# (PrimState (GenT m)) -> (# State# (PrimState (GenT m)), a #)) -> GenT m a #

MonadResource m => MonadResource (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

liftResourceT :: ResourceT IO a -> GenT m a #

Monad m => MonadGen (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (GenT m) :: Type -> Type Source #

Methods

toGenT :: GenT m a -> GenT (GenBase (GenT m)) a Source #

fromGenT :: GenT (GenBase (GenT m)) a -> GenT m a Source #

MFunctor GenT Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> GenT m b -> GenT n b #

(Monad m, Semigroup a) => Semigroup (GenT m a) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

(<>) :: GenT m a -> GenT m a -> GenT m a #

sconcat :: NonEmpty (GenT m a) -> GenT m a #

stimes :: Integral b => b -> GenT m a -> GenT m a #

(Monad m, Monoid a) => Monoid (GenT m a) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Methods

mempty :: GenT m a #

mappend :: GenT m a -> GenT m a -> GenT m a #

mconcat :: [GenT m a] -> GenT m a #

type Transformer t GenT m Source # 
Instance details

Defined in Hedgehog.Internal.Gen

type PrimState (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

type PrimState (GenT m) = PrimState m
type GenBase (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

type GenBase (GenT m) = m
type StM (GenT m) a Source # 
Instance details

Defined in Hedgehog.Internal.Gen

type StM (GenT m) a = StM (ReaderT Size (ReaderT Seed (TreeT (MaybeT m)))) a

class (Monad m, Monad (GenBase m)) => MonadGen m where Source #

Class of monads which can generate input data for tests.

Associated Types

type GenBase m :: Type -> Type Source #

Methods

toGenT :: m a -> GenT (GenBase m) a Source #

Extract a GenT from a MonadGen.

fromGenT :: GenT (GenBase m) a -> m a Source #

Lift a GenT in to a MonadGen.

Instances

Instances details
MonadGen m => MonadGen (MaybeT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (MaybeT m) :: Type -> Type Source #

Methods

toGenT :: MaybeT m a -> GenT (GenBase (MaybeT m)) a Source #

fromGenT :: GenT (GenBase (MaybeT m)) a -> MaybeT m a Source #

Monad m => MonadGen (GenT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (GenT m) :: Type -> Type Source #

Methods

toGenT :: GenT m a -> GenT (GenBase (GenT m)) a Source #

fromGenT :: GenT (GenBase (GenT m)) a -> GenT m a Source #

MonadGen m => MonadGen (ReaderT r m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (ReaderT r m) :: Type -> Type Source #

Methods

toGenT :: ReaderT r m a -> GenT (GenBase (ReaderT r m)) a Source #

fromGenT :: GenT (GenBase (ReaderT r m)) a -> ReaderT r m a Source #

MonadGen m => MonadGen (ExceptT x m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (ExceptT x m) :: Type -> Type Source #

Methods

toGenT :: ExceptT x m a -> GenT (GenBase (ExceptT x m)) a Source #

fromGenT :: GenT (GenBase (ExceptT x m)) a -> ExceptT x m a Source #

(MonadGen m, Monoid w) => MonadGen (WriterT w m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (WriterT w m) :: Type -> Type Source #

Methods

toGenT :: WriterT w m a -> GenT (GenBase (WriterT w m)) a Source #

fromGenT :: GenT (GenBase (WriterT w m)) a -> WriterT w m a Source #

MonadGen m => MonadGen (StateT r m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (StateT r m) :: Type -> Type Source #

Methods

toGenT :: StateT r m a -> GenT (GenBase (StateT r m)) a Source #

fromGenT :: GenT (GenBase (StateT r m)) a -> StateT r m a Source #

MonadGen m => MonadGen (IdentityT m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (IdentityT m) :: Type -> Type Source #

MonadGen m => MonadGen (StateT r m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (StateT r m) :: Type -> Type Source #

Methods

toGenT :: StateT r m a -> GenT (GenBase (StateT r m)) a Source #

fromGenT :: GenT (GenBase (StateT r m)) a -> StateT r m a Source #

(MonadGen m, Monoid w) => MonadGen (WriterT w m) Source # 
Instance details

Defined in Hedgehog.Internal.Gen

Associated Types

type GenBase (WriterT w m) :: Type -> Type Source #

Methods

toGenT :: WriterT w m a -> GenT (GenBase (WriterT w m)) a Source #

fromGenT :: GenT (GenBase (WriterT w m)) a -> WriterT w m a Source #

data Range a Source #

A range describes the bounds of a number to generate, which may or may not be dependent on a Size.

The constructor takes an origin between the lower and upper bound, and a function from Size to bounds. As the size goes towards 0, the values go towards the origin.

Instances

Instances details
Functor Range Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

fmap :: (a -> b) -> Range a -> Range b #

(<$) :: a -> Range b -> Range a #

newtype Size Source #

Tests are parameterized by the size of the randomly-generated data. The meaning of a Size value depends on the particular generator used, but it must always be a number between 0 and 99 inclusive.

Constructors

Size 

Fields

Instances

Instances details
Enum Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

succ :: Size -> Size #

pred :: Size -> Size #

toEnum :: Int -> Size #

fromEnum :: Size -> Int #

enumFrom :: Size -> [Size] #

enumFromThen :: Size -> Size -> [Size] #

enumFromTo :: Size -> Size -> [Size] #

enumFromThenTo :: Size -> Size -> Size -> [Size] #

Eq Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Integral Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

quot :: Size -> Size -> Size #

rem :: Size -> Size -> Size #

div :: Size -> Size -> Size #

mod :: Size -> Size -> Size #

quotRem :: Size -> Size -> (Size, Size) #

divMod :: Size -> Size -> (Size, Size) #

toInteger :: Size -> Integer #

Num Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

(+) :: Size -> Size -> Size #

(-) :: Size -> Size -> Size #

(*) :: Size -> Size -> Size #

negate :: Size -> Size #

abs :: Size -> Size #

signum :: Size -> Size #

fromInteger :: Integer -> Size #

Ord Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

Read Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Real Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

toRational :: Size -> Rational #

Show Size Source # 
Instance details

Defined in Hedgehog.Internal.Range

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

data Seed Source #

A splittable random number generator.

Constructors

Seed 

Fields

Instances

Instances details
Eq Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Methods

(==) :: Seed -> Seed -> Bool #

(/=) :: Seed -> Seed -> Bool #

Ord Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Methods

compare :: Seed -> Seed -> Ordering #

(<) :: Seed -> Seed -> Bool #

(<=) :: Seed -> Seed -> Bool #

(>) :: Seed -> Seed -> Bool #

(>=) :: Seed -> Seed -> Bool #

max :: Seed -> Seed -> Seed #

min :: Seed -> Seed -> Seed #

Read Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Show Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Methods

showsPrec :: Int -> Seed -> ShowS #

show :: Seed -> String #

showList :: [Seed] -> ShowS #

RandomGen Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Lift Seed Source # 
Instance details

Defined in Hedgehog.Internal.Seed

Methods

lift :: Seed -> Q Exp #

liftTyped :: Seed -> Q (TExp Seed) #

Tests

type Test = TestT Identity Source #

A test monad allows the assertion of expectations.

data TestT m a Source #

A test monad transformer allows the assertion of expectations.

Instances

Instances details
MonadTrans TestT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

lift :: Monad m => m a -> TestT m a #

MonadTransControl TestT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type StT TestT a #

Methods

liftWith :: Monad m => (Run TestT -> m a) -> TestT m a #

restoreT :: Monad m => m (StT TestT a) -> TestT m a #

MonadTransDistributive TestT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type Transformer f TestT m Source #

Methods

distributeT :: forall f (m :: Type -> Type) a. Transformer f TestT m => TestT (f m) a -> f (TestT m) a Source #

MonadBase b m => MonadBase b (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftBase :: b α -> TestT m α #

MonadBaseControl b m => MonadBaseControl b (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type StM (TestT m) a #

Methods

liftBaseWith :: (RunInBase (TestT m) b -> b a) -> TestT m a #

restoreM :: StM (TestT m) a -> TestT m a #

MonadState s m => MonadState s (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

get :: TestT m s #

put :: s -> TestT m () #

state :: (s -> (a, s)) -> TestT m a #

MonadReader r m => MonadReader r (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

ask :: TestT m r #

local :: (r -> r) -> TestT m a -> TestT m a #

reader :: (r -> a) -> TestT m a #

MonadError e m => MonadError e (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwError :: e -> TestT m a #

catchError :: TestT m a -> (e -> TestT m a) -> TestT m a #

Monad m => Monad (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

(>>=) :: TestT m a -> (a -> TestT m b) -> TestT m b #

(>>) :: TestT m a -> TestT m b -> TestT m b #

return :: a -> TestT m a #

Functor m => Functor (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

fmap :: (a -> b) -> TestT m a -> TestT m b #

(<$) :: a -> TestT m b -> TestT m a #

Monad m => MonadFail (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

fail :: String -> TestT m a #

Monad m => Applicative (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

pure :: a -> TestT m a #

(<*>) :: TestT m (a -> b) -> TestT m a -> TestT m b #

liftA2 :: (a -> b -> c) -> TestT m a -> TestT m b -> TestT m c #

(*>) :: TestT m a -> TestT m b -> TestT m b #

(<*) :: TestT m a -> TestT m b -> TestT m a #

MonadIO m => MonadIO (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftIO :: IO a -> TestT m a #

MonadCatch m => MonadCatch (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

catch :: Exception e => TestT m a -> (e -> TestT m a) -> TestT m a #

MonadThrow m => MonadThrow (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

throwM :: Exception e => e -> TestT m a #

PrimMonad m => PrimMonad (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Associated Types

type PrimState (TestT m) #

Methods

primitive :: (State# (PrimState (TestT m)) -> (# State# (PrimState (TestT m)), a #)) -> TestT m a #

MonadResource m => MonadResource (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftResourceT :: ResourceT IO a -> TestT m a #

Monad m => MonadTest (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> TestT m a Source #

MFunctor TestT Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> TestT m b -> TestT n b #

type StT TestT a Source # 
Instance details

Defined in Hedgehog.Internal.Property

type Transformer t TestT m Source # 
Instance details

Defined in Hedgehog.Internal.Property

type PrimState (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

type StM (TestT m) a Source # 
Instance details

Defined in Hedgehog.Internal.Property

type StM (TestT m) a = ComposeSt TestT m a

class Monad m => MonadTest m where Source #

Methods

liftTest :: Test a -> m a Source #

Instances

Instances details
MonadTest m => MonadTest (MaybeT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> MaybeT m a Source #

MonadTest m => MonadTest (ResourceT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> ResourceT m a Source #

Monad m => MonadTest (TestT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> TestT m a Source #

Monad m => MonadTest (PropertyT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> PropertyT m a Source #

MonadTest m => MonadTest (ReaderT r m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> ReaderT r m a Source #

MonadTest m => MonadTest (ExceptT x m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> ExceptT x m a Source #

(MonadTest m, Monoid w) => MonadTest (WriterT w m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> WriterT w m a Source #

MonadTest m => MonadTest (StateT s m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> StateT s m a Source #

MonadTest m => MonadTest (IdentityT m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> IdentityT m a Source #

MonadTest m => MonadTest (StateT s m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> StateT s m a Source #

(MonadTest m, Monoid w) => MonadTest (WriterT w m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> WriterT w m a Source #

MonadTest m => MonadTest (ContT r m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> ContT r m a Source #

(MonadTest m, Monoid w) => MonadTest (RWST r w s m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> RWST r w s m a Source #

(MonadTest m, Monoid w) => MonadTest (RWST r w s m) Source # 
Instance details

Defined in Hedgehog.Internal.Property

Methods

liftTest :: Test a -> RWST r w s m a Source #

annotate :: (MonadTest m, HasCallStack) => String -> m () Source #

Annotates the source code with a message that might be useful for debugging a test failure.

annotateShow :: (MonadTest m, Show a, HasCallStack) => a -> m () Source #

Annotates the source code with a value that might be useful for debugging a test failure.

footnote :: MonadTest m => String -> m () Source #

Logs a message to be displayed as additional information in the footer of the failure report.

footnoteShow :: (MonadTest m, Show a) => a -> m () Source #

Logs a value to be displayed as additional information in the footer of the failure report.

success :: MonadTest m => m () Source #

Another name for pure ().

failure :: (MonadTest m, HasCallStack) => m a Source #

Causes a test to fail.

assert :: (MonadTest m, HasCallStack) => Bool -> m () Source #

Fails the test if the condition provided is False.

diff :: (MonadTest m, Show a, Show b, HasCallStack) => a -> (a -> b -> Bool) -> b -> m () Source #

Fails the test and shows a git-like diff if the comparison operation evaluates to False when applied to its arguments.

The comparison function is the second argument, which may be counter-intuitive to Haskell programmers. However, it allows operators to be written infix for easy reading:

  diff y (<) 87
  diff x (<=) r

This function behaves like the unix diff tool, which gives a 0 exit code if the compared files are identical, or a 1 exit code code otherwise. Like unix diff, if the arguments fail the comparison, a /diff is shown.

(===) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () infix 4 Source #

Fails the test if the two arguments provided are not equal.

(/==) :: (MonadTest m, Eq a, Show a, HasCallStack) => a -> a -> m () infix 4 Source #

Fails the test if the two arguments provided are equal.

tripping :: (MonadTest m, Applicative f, Show b, Show (f a), Eq (f a), HasCallStack) => a -> (a -> b) -> (b -> f a) -> m () Source #

Test that a pair of encode / decode functions are compatible.

Given a printer from some type a -> b, and a parser with a potential failure case b -> f a. Ensure that a valid a round trips through the "print" and "parse" to yield the same a.

For example, types should have tripping Read and Show instances:

trippingShowRead :: (Show a, Read a, Eq a, MonadTest m) => a -> m ()
trippingShowRead a = tripping a show readEither

eval :: (MonadTest m, HasCallStack) => a -> m a Source #

Fails the test if the value throws an exception when evaluated to weak head normal form (WHNF).

evalNF :: (MonadTest m, NFData a, HasCallStack) => a -> m a Source #

Fails the test if the value throws an exception when evaluated to normal form (NF).

evalM :: (MonadTest m, MonadCatch m, HasCallStack) => m a -> m a Source #

Fails the test if the action throws an exception.

The benefit of using this over simply letting the exception bubble up is that the location of the closest evalM will be shown in the output.

evalIO :: (MonadTest m, MonadIO m, HasCallStack) => IO a -> m a Source #

Fails the test if the IO action throws an exception.

The benefit of using this over liftIO is that the location of the exception will be shown in the output.

evalEither :: (MonadTest m, Show x, HasCallStack) => Either x a -> m a Source #

Fails the test if the Either is Left, otherwise returns the value in the Right.

evalEitherM :: (MonadTest m, Show x, MonadCatch m, HasCallStack) => m (Either x a) -> m a Source #

Fails the test if the action throws an exception, or if the Either is Left, otherwise returns the value in the Right.

evalExceptT :: (MonadTest m, Show x, HasCallStack) => ExceptT x m a -> m a Source #

Fails the test if the ExceptT is Left, otherwise returns the value in the Right.

evalMaybe :: (MonadTest m, Show a, HasCallStack) => Maybe a -> m a Source #

Fails the test if the Maybe is Nothing, otherwise returns the value in the Just.

evalMaybeM :: (MonadTest m, Show a, MonadCatch m, HasCallStack) => m (Maybe a) -> m a Source #

Fails the test if the action throws an exception, or if the Maybe is Nothing, otherwise returns the value in the Just.

Coverage

data LabelName Source #

The name of a classifier.

Should be constructed using OverloadedStrings:

  "apples" :: LabelName

classify :: (MonadTest m, HasCallStack) => LabelName -> Bool -> m () Source #

Records the proportion of tests which satisfy a given condition.

   prop_with_classifier :: Property
   prop_with_classifier =
     property $ do
       xs <- forAll $ Gen.list (Range.linear 0 100) Gen.alpha
       for_ xs $ \x -> do
         classify "newborns" $ x == 0
         classify "children" $ x > 0 && x < 13
         classify "teens" $ x > 12 && x < 20

cover :: (MonadTest m, HasCallStack) => CoverPercentage -> LabelName -> Bool -> m () Source #

Require a certain percentage of the tests to be covered by the classifier.

   prop_with_coverage :: Property
   prop_with_coverage =
     property $ do
       match <- forAll Gen.bool
       cover 30 "True" $ match
       cover 30 "False" $ not match

The example above requires a minimum of 30% coverage for both classifiers. If these requirements are not met, it will fail the test.

label :: (MonadTest m, HasCallStack) => LabelName -> m () Source #

Add a label for each test run. It produces a table showing the percentage of test runs that produced each label.

collect :: (MonadTest m, Show a, HasCallStack) => a -> m () Source #

Like label, but uses Show to render its argument for display.

State Machine Tests

data Command gen m (state :: (Type -> Type) -> Type) Source #

The specification for the expected behaviour of an Action. These are used to generate sequences of actions to test.

This is the main type you will use when writing state machine tests. gen is usually an instance of MonadGen, and m is usually an instance of MonadTest. These constraints appear when you pass your Command list to sequential or parallel.

Constructors

forall input output.(TraversableB input, Show (input Symbolic), Show output, Typeable output) => Command 

Fields

  • commandGen :: state Symbolic -> Maybe (gen (input Symbolic))

    A generator which provides random arguments for a command. If the command cannot be executed in the current state, it should return Nothing.

  • commandExecute :: input Concrete -> m output

    Executes a command using the arguments generated by commandGen.

  • commandCallbacks :: [Callback input output state]

    A set of callbacks which provide optional command configuration such as pre-condtions, post-conditions and state updates.

data Callback input output state Source #

Optional command configuration.

Constructors

Require (state Symbolic -> input Symbolic -> Bool)

A pre-condition for a command that must be verified before the command can be executed. This is mainly used during shrinking to ensure that it is still OK to run a command despite the fact that some previously executed commands may have been removed from the sequence.

Update (forall v. Ord1 v => state v -> input v -> Var output v -> state v)

Updates the model state, given the input and output of the command. Note that this function is polymorphic in the type of values. This is because it must work over Symbolic values when we are generating actions, and Concrete values when we are executing them.

Ensure (state Concrete -> state Concrete -> input Concrete -> output -> Test ())

A post-condition for a command that must be verified for the command to be considered a success.

This callback receives the state prior to execution as the first argument, and the state after execution as the second argument.

data Action m (state :: (Type -> Type) -> Type) Source #

An instantiation of a Command which can be executed, and its effect evaluated.

Instances

Instances details
Show (Action m state) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Action m state -> ShowS #

show :: Action m state -> String #

showList :: [Action m state] -> ShowS #

newtype Sequential m state Source #

A sequence of actions to execute.

Constructors

Sequential 

Fields

Instances

Instances details
Show (Sequential m state) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Sequential m state -> ShowS #

show :: Sequential m state -> String #

showList :: [Sequential m state] -> ShowS #

data Parallel m state Source #

A sequential prefix of actions to execute, with two branches to execute in parallel.

Constructors

Parallel 

Fields

Instances

Instances details
Show (Parallel m state) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Parallel m state -> ShowS #

show :: Parallel m state -> String #

showList :: [Parallel m state] -> ShowS #

executeSequential :: (MonadTest m, MonadCatch m, HasCallStack) => (forall v. state v) -> Sequential m state -> m () Source #

Executes a list of actions sequentially, verifying that all post-conditions are met and no exceptions are thrown.

To generate a sequence of actions to execute, see the sequential combinator in the Hedgehog.Gen module.

executeParallel :: (MonadTest m, MonadCatch m, MonadBaseControl IO m, HasCallStack) => (forall v. state v) -> Parallel m state -> m () Source #

Executes the prefix actions sequentially, then executes the two branches in parallel, verifying that no exceptions are thrown and that there is at least one sequential interleaving where all the post-conditions are met.

To generate parallel actions to execute, see the parallel combinator in the Hedgehog.Gen module.

newtype Var a v Source #

Variables are the potential or actual result of executing an action. They are parameterised by either Symbolic or Concrete depending on the phase of the test.

Symbolic variables are the potential results of actions. These are used when generating the sequence of actions to execute. They allow actions which occur later in the sequence to make use of the result of an action which came earlier in the sequence.

Concrete variables are the actual results of actions. These are used during test execution. They provide access to the actual runtime value of a variable.

The state update Callback for a command needs to be polymorphic in the type of variable because it is used in both the generation and the execution phase.

The order of arguments makes Var HTraverable, which is how Symbolic values are turned into Concrete ones.

Constructors

Var (v a) 

Instances

Instances details
TraversableB (Var a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

btraverse :: Applicative e => (forall (a0 :: k). f a0 -> e (g a0)) -> Var a f -> e (Var a g) #

FunctorB (Var a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

bmap :: (forall (a0 :: k). f a0 -> g a0) -> Var a f -> Var a g #

(Eq a, Eq1 v) => Eq (Var a v) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

(==) :: Var a v -> Var a v -> Bool #

(/=) :: Var a v -> Var a v -> Bool #

(Ord a, Ord1 v) => Ord (Var a v) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

compare :: Var a v -> Var a v -> Ordering #

(<) :: Var a v -> Var a v -> Bool #

(<=) :: Var a v -> Var a v -> Bool #

(>) :: Var a v -> Var a v -> Bool #

(>=) :: Var a v -> Var a v -> Bool #

max :: Var a v -> Var a v -> Var a v #

min :: Var a v -> Var a v -> Var a v #

(Show a, Show1 v) => Show (Var a v) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Var a v -> ShowS #

show :: Var a v -> String #

showList :: [Var a v] -> ShowS #

concrete :: Var a Concrete -> a Source #

Take the value from a concrete variable.

opaque :: Var (Opaque a) Concrete -> a Source #

Take the value from an opaque concrete variable.

data Symbolic a Source #

Symbolic values: Because hedgehog generates actions in a separate phase before execution, you will sometimes need to refer to the result of a previous action in a generator without knowing the value of the result (e.g., to get the ID of a previously-created user).

Symbolic variables provide a token to stand in for the actual variables at generation time (and in Require/Update callbacks). At execution time, real values are available, so your execute actions work on Concrete variables.

See also: Command, Var

Instances

Instances details
Eq1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftEq :: (a -> b -> Bool) -> Symbolic a -> Symbolic b -> Bool #

Ord1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftCompare :: (a -> b -> Ordering) -> Symbolic a -> Symbolic b -> Ordering #

Show1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Symbolic a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Symbolic a] -> ShowS #

Eq (Symbolic a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

(==) :: Symbolic a -> Symbolic a -> Bool #

(/=) :: Symbolic a -> Symbolic a -> Bool #

Ord (Symbolic a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

compare :: Symbolic a -> Symbolic a -> Ordering #

(<) :: Symbolic a -> Symbolic a -> Bool #

(<=) :: Symbolic a -> Symbolic a -> Bool #

(>) :: Symbolic a -> Symbolic a -> Bool #

(>=) :: Symbolic a -> Symbolic a -> Bool #

max :: Symbolic a -> Symbolic a -> Symbolic a #

min :: Symbolic a -> Symbolic a -> Symbolic a #

Show (Symbolic a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Symbolic a -> ShowS #

show :: Symbolic a -> String #

showList :: [Symbolic a] -> ShowS #

newtype Concrete a where Source #

Concrete values: At test-execution time, Symbolic values from generation are replaced with Concrete values from performing actions. This type gives us something of the same kind as Symbolic to pass as a type argument to Var.

Constructors

Concrete :: a -> Concrete a 

Instances

Instances details
Functor Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

fmap :: (a -> b) -> Concrete a -> Concrete b #

(<$) :: a -> Concrete b -> Concrete a #

Foldable Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

fold :: Monoid m => Concrete m -> m #

foldMap :: Monoid m => (a -> m) -> Concrete a -> m #

foldMap' :: Monoid m => (a -> m) -> Concrete a -> m #

foldr :: (a -> b -> b) -> b -> Concrete a -> b #

foldr' :: (a -> b -> b) -> b -> Concrete a -> b #

foldl :: (b -> a -> b) -> b -> Concrete a -> b #

foldl' :: (b -> a -> b) -> b -> Concrete a -> b #

foldr1 :: (a -> a -> a) -> Concrete a -> a #

foldl1 :: (a -> a -> a) -> Concrete a -> a #

toList :: Concrete a -> [a] #

null :: Concrete a -> Bool #

length :: Concrete a -> Int #

elem :: Eq a => a -> Concrete a -> Bool #

maximum :: Ord a => Concrete a -> a #

minimum :: Ord a => Concrete a -> a #

sum :: Num a => Concrete a -> a #

product :: Num a => Concrete a -> a #

Traversable Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

traverse :: Applicative f => (a -> f b) -> Concrete a -> f (Concrete b) #

sequenceA :: Applicative f => Concrete (f a) -> f (Concrete a) #

mapM :: Monad m => (a -> m b) -> Concrete a -> m (Concrete b) #

sequence :: Monad m => Concrete (m a) -> m (Concrete a) #

Eq1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftEq :: (a -> b -> Bool) -> Concrete a -> Concrete b -> Bool #

Ord1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftCompare :: (a -> b -> Ordering) -> Concrete a -> Concrete b -> Ordering #

Show1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Concrete a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Concrete a] -> ShowS #

Eq a => Eq (Concrete a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

(==) :: Concrete a -> Concrete a -> Bool #

(/=) :: Concrete a -> Concrete a -> Bool #

Ord a => Ord (Concrete a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

compare :: Concrete a -> Concrete a -> Ordering #

(<) :: Concrete a -> Concrete a -> Bool #

(<=) :: Concrete a -> Concrete a -> Bool #

(>) :: Concrete a -> Concrete a -> Bool #

(>=) :: Concrete a -> Concrete a -> Bool #

max :: Concrete a -> Concrete a -> Concrete a #

min :: Concrete a -> Concrete a -> Concrete a #

Show a => Show (Concrete a) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

showsPrec :: Int -> Concrete a -> ShowS #

show :: Concrete a -> String #

showList :: [Concrete a] -> ShowS #

newtype Opaque a Source #

Opaque values.

Useful if you want to put something without a Show instance inside something which you'd like to be able to display.

For example:

  data State v =
    State {
        stateRefs :: [Var (Opaque (IORef Int)) v]
      } deriving (Eq, Show)

Constructors

Opaque 

Fields

Instances

Instances details
Eq a => Eq (Opaque a) Source # 
Instance details

Defined in Hedgehog.Internal.Opaque

Methods

(==) :: Opaque a -> Opaque a -> Bool #

(/=) :: Opaque a -> Opaque a -> Bool #

Ord a => Ord (Opaque a) Source # 
Instance details

Defined in Hedgehog.Internal.Opaque

Methods

compare :: Opaque a -> Opaque a -> Ordering #

(<) :: Opaque a -> Opaque a -> Bool #

(<=) :: Opaque a -> Opaque a -> Bool #

(>) :: Opaque a -> Opaque a -> Bool #

(>=) :: Opaque a -> Opaque a -> Bool #

max :: Opaque a -> Opaque a -> Opaque a #

min :: Opaque a -> Opaque a -> Opaque a #

Show (Opaque a) Source # 
Instance details

Defined in Hedgehog.Internal.Opaque

Methods

showsPrec :: Int -> Opaque a -> ShowS #

show :: Opaque a -> String #

showList :: [Opaque a] -> ShowS #

Transformers

distributeT :: (MonadTransDistributive g, Transformer f g m) => g (f m) a -> f (g m) a Source #

Distribute one monad transformer over another.

Functors

FunctorB and TraversableB must be implemented for all Command input types.

This is most easily achieved using DeriveGeneric:

data Register v =
  Register Name (Var Pid v)
  deriving (Eq, Show, Generic)

instance FunctorB Register
instance TraversableB Register

newtype Unregister (v :: * -> *) =
  Unregister Name
  deriving (Eq, Show, Generic)

instance FunctorB Unregister
instance TraversableB Unregister

DeriveAnyClass and DerivingStrategies allow a more compact syntax:

data Register v =
  Register Name (Var Pid v)
  deriving (Eq, Show, Generic, FunctorB, TraversableB)

newtype Unregister (v :: * -> *) =
  Unregister Name
  deriving (Eq, Show, Generic)
  deriving anyclass (FunctorB, TraversableB)

class FunctorB (b :: (k -> Type) -> Type) where #

Barbie-types that can be mapped over. Instances of FunctorB should satisfy the following laws:

bmap id = id
bmap f . bmap g = bmap (f . g)

There is a default bmap implementation for Generic types, so instances can derived automatically.

Minimal complete definition

Nothing

Methods

bmap :: (forall (a :: k). f a -> g a) -> b f -> b g #

Instances

Instances details
FunctorB (Proxy :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a :: k0). f a -> g a) -> Proxy f -> Proxy g #

FunctorB (Constant x :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a :: k0). f a -> g a) -> Constant x f -> Constant x g #

FunctorB (Const x :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a :: k0). f a -> g a) -> Const x f -> Const x g #

(FunctorB a, FunctorB b) => FunctorB (Sum a b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a0 :: k0). f a0 -> g a0) -> Sum a b f -> Sum a b g #

(FunctorB a, FunctorB b) => FunctorB (Product a b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a0 :: k0). f a0 -> g a0) -> Product a b f -> Product a b g #

(Functor f, FunctorB b) => FunctorB (Compose f b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.FunctorB

Methods

bmap :: (forall (a :: k0). f0 a -> g a) -> Compose f b f0 -> Compose f b g #

FunctorB (Var a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

bmap :: (forall (a0 :: k). f a0 -> g a0) -> Var a f -> Var a g #

class FunctorB b => TraversableB (b :: (k -> Type) -> Type) where #

Barbie-types that can be traversed from left to right. Instances should satisfy the following laws:

 t . btraverse f   = btraverse (t . f)  -- naturality
btraverse Identity = Identity           -- identity
btraverse (Compose . fmap g . f) = Compose . fmap (btraverse g) . btraverse f -- composition

There is a default btraverse implementation for Generic types, so instances can derived automatically.

Minimal complete definition

Nothing

Methods

btraverse :: Applicative e => (forall (a :: k). f a -> e (g a)) -> b f -> e (b g) #

Instances

Instances details
TraversableB (Proxy :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a :: k0). f a -> e (g a)) -> Proxy f -> e (Proxy g) #

TraversableB (Constant a :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a0 :: k0). f a0 -> e (g a0)) -> Constant a f -> e (Constant a g) #

TraversableB (Const a :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a0 :: k0). f a0 -> e (g a0)) -> Const a f -> e (Const a g) #

(TraversableB a, TraversableB b) => TraversableB (Sum a b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a0 :: k0). f a0 -> e (g a0)) -> Sum a b f -> e (Sum a b g) #

(TraversableB a, TraversableB b) => TraversableB (Product a b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a0 :: k0). f a0 -> e (g a0)) -> Product a b f -> e (Product a b g) #

(Traversable f, TraversableB b) => TraversableB (Compose f b :: (k -> Type) -> Type) 
Instance details

Defined in Barbies.Internal.TraversableB

Methods

btraverse :: Applicative e => (forall (a :: k0). f0 a -> e (g a)) -> Compose f b f0 -> e (Compose f b g) #

TraversableB (Var a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

btraverse :: Applicative e => (forall (a0 :: k). f a0 -> e (g a0)) -> Var a f -> e (Var a g) #

newtype Rec p a (x :: k) #

Constructors

Rec 

Fields

Instances

Instances details
GConstraints n (c :: k1 -> Constraint) (f :: k2) (Rec a' a :: Type -> Type) (Rec b' b :: k3 -> Type) (Rec b' b :: k3 -> Type) 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: forall (x :: k20). GAll n c (Rec a' a) => Rec b' b x -> Rec b' b x #

GConstraints n (c :: k1 -> Constraint) (f :: k1 -> Type) (Rec (P n (X :: k1 -> Type) a') (X a) :: Type -> Type) (Rec (P n f a') (f a) :: k2 -> Type) (Rec (P n (Product (Dict c) f) a') (Product (Dict c) f a) :: k2 -> Type) 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: forall (x :: k20). GAll n c (Rec (P n X a') (X a)) => Rec (P n f a') (f a) x -> Rec (P n (Product (Dict c) f) a') (Product (Dict c) f a) x #

type GAll n (c :: k -> Constraint) (Rec l r :: Type -> Type) 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (Rec l r :: Type -> Type) = GAllRec n c l r

class Eq1 (f :: Type -> Type) #

Lifting of the Eq class to unary type constructors.

Since: base-4.9.0.0

Minimal complete definition

liftEq

Instances

Instances details
Eq1 []

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> [a] -> [b] -> Bool #

Eq1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Maybe a -> Maybe b -> Bool #

Eq1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Identity a -> Identity b -> Bool #

Eq1 Down

Since: base-4.12.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Down a -> Down b -> Bool #

Eq1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> NonEmpty a -> NonEmpty b -> Bool #

Eq1 IntMap

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

liftEq :: (a -> b -> Bool) -> IntMap a -> IntMap b -> Bool #

Eq1 Tree

Since: containers-0.5.9

Instance details

Defined in Data.Tree

Methods

liftEq :: (a -> b -> Bool) -> Tree a -> Tree b -> Bool #

Eq1 Seq

Since: containers-0.5.9

Instance details

Defined in Data.Sequence.Internal

Methods

liftEq :: (a -> b -> Bool) -> Seq a -> Seq b -> Bool #

Eq1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftEq :: (a -> b -> Bool) -> Set a -> Set b -> Bool #

Eq1 Hashed 
Instance details

Defined in Data.Hashable.Class

Methods

liftEq :: (a -> b -> Bool) -> Hashed a -> Hashed b -> Bool #

Eq1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftEq :: (a -> b -> Bool) -> Concrete a -> Concrete b -> Bool #

Eq1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftEq :: (a -> b -> Bool) -> Symbolic a -> Symbolic b -> Bool #

Eq a => Eq1 (Either a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a0 -> b -> Bool) -> Either a a0 -> Either a b -> Bool #

Eq a => Eq1 ((,) a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a0 -> b -> Bool) -> (a, a0) -> (a, b) -> Bool #

Eq1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> Proxy a -> Proxy b -> Bool #

Eq k => Eq1 (Map k)

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

liftEq :: (a -> b -> Bool) -> Map k a -> Map k b -> Bool #

Eq1 m => Eq1 (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftEq :: (a -> b -> Bool) -> MaybeT m a -> MaybeT m b -> Bool #

Eq1 m => Eq1 (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

liftEq :: (a -> b -> Bool) -> ListT m a -> ListT m b -> Bool #

Eq a => Eq1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a0 -> b -> Bool) -> Const a a0 -> Const a b -> Bool #

(Eq e, Eq1 m) => Eq1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftEq :: (a -> b -> Bool) -> ExceptT e m a -> ExceptT e m b -> Bool #

(Eq w, Eq1 m) => Eq1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftEq :: (a -> b -> Bool) -> WriterT w m a -> WriterT w m b -> Bool #

(Eq e, Eq1 m) => Eq1 (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftEq :: (a -> b -> Bool) -> ErrorT e m a -> ErrorT e m b -> Bool #

Eq1 f => Eq1 (IdentityT f) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftEq :: (a -> b -> Bool) -> IdentityT f a -> IdentityT f b -> Bool #

(Eq w, Eq1 m) => Eq1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftEq :: (a -> b -> Bool) -> WriterT w m a -> WriterT w m b -> Bool #

Eq1 (Tagged s) 
Instance details

Defined in Data.Tagged

Methods

liftEq :: (a -> b -> Bool) -> Tagged s a -> Tagged s b -> Bool #

(Eq1 f, Eq1 g) => Eq1 (Product f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

liftEq :: (a -> b -> Bool) -> Product f g a -> Product f g b -> Bool #

(Eq1 f, Eq1 g) => Eq1 (Sum f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Sum

Methods

liftEq :: (a -> b -> Bool) -> Sum f g a -> Sum f g b -> Bool #

(Eq1 f, Eq1 g) => Eq1 (Compose f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftEq :: (a -> b -> Bool) -> Compose f g a -> Compose f g b -> Bool #

eq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool #

Lift the standard (==) function through the type constructor.

Since: base-4.9.0.0

class Eq1 f => Ord1 (f :: Type -> Type) #

Lifting of the Ord class to unary type constructors.

Since: base-4.9.0.0

Minimal complete definition

liftCompare

Instances

Instances details
Ord1 []

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> [a] -> [b] -> Ordering #

Ord1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Maybe a -> Maybe b -> Ordering #

Ord1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Identity a -> Identity b -> Ordering #

Ord1 Down

Since: base-4.12.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Down a -> Down b -> Ordering #

Ord1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> NonEmpty a -> NonEmpty b -> Ordering #

Ord1 IntMap

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> IntMap a -> IntMap b -> Ordering #

Ord1 Tree

Since: containers-0.5.9

Instance details

Defined in Data.Tree

Methods

liftCompare :: (a -> b -> Ordering) -> Tree a -> Tree b -> Ordering #

Ord1 Seq

Since: containers-0.5.9

Instance details

Defined in Data.Sequence.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> Seq a -> Seq b -> Ordering #

Ord1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> Set a -> Set b -> Ordering #

Ord1 Hashed 
Instance details

Defined in Data.Hashable.Class

Methods

liftCompare :: (a -> b -> Ordering) -> Hashed a -> Hashed b -> Ordering #

Ord1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftCompare :: (a -> b -> Ordering) -> Concrete a -> Concrete b -> Ordering #

Ord1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftCompare :: (a -> b -> Ordering) -> Symbolic a -> Symbolic b -> Ordering #

Ord a => Ord1 (Either a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a0 -> b -> Ordering) -> Either a a0 -> Either a b -> Ordering #

Ord a => Ord1 ((,) a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a0 -> b -> Ordering) -> (a, a0) -> (a, b) -> Ordering #

Ord1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> Proxy a -> Proxy b -> Ordering #

Ord k => Ord1 (Map k)

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

liftCompare :: (a -> b -> Ordering) -> Map k a -> Map k b -> Ordering #

Ord1 m => Ord1 (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftCompare :: (a -> b -> Ordering) -> MaybeT m a -> MaybeT m b -> Ordering #

Ord1 m => Ord1 (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

liftCompare :: (a -> b -> Ordering) -> ListT m a -> ListT m b -> Ordering #

Ord a => Ord1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a0 -> b -> Ordering) -> Const a a0 -> Const a b -> Ordering #

(Ord e, Ord1 m) => Ord1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftCompare :: (a -> b -> Ordering) -> ExceptT e m a -> ExceptT e m b -> Ordering #

(Ord w, Ord1 m) => Ord1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftCompare :: (a -> b -> Ordering) -> WriterT w m a -> WriterT w m b -> Ordering #

(Ord e, Ord1 m) => Ord1 (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftCompare :: (a -> b -> Ordering) -> ErrorT e m a -> ErrorT e m b -> Ordering #

Ord1 f => Ord1 (IdentityT f) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftCompare :: (a -> b -> Ordering) -> IdentityT f a -> IdentityT f b -> Ordering #

(Ord w, Ord1 m) => Ord1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftCompare :: (a -> b -> Ordering) -> WriterT w m a -> WriterT w m b -> Ordering #

Ord1 (Tagged s) 
Instance details

Defined in Data.Tagged

Methods

liftCompare :: (a -> b -> Ordering) -> Tagged s a -> Tagged s b -> Ordering #

(Ord1 f, Ord1 g) => Ord1 (Product f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

liftCompare :: (a -> b -> Ordering) -> Product f g a -> Product f g b -> Ordering #

(Ord1 f, Ord1 g) => Ord1 (Sum f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Sum

Methods

liftCompare :: (a -> b -> Ordering) -> Sum f g a -> Sum f g b -> Ordering #

(Ord1 f, Ord1 g) => Ord1 (Compose f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftCompare :: (a -> b -> Ordering) -> Compose f g a -> Compose f g b -> Ordering #

compare1 :: (Ord1 f, Ord a) => f a -> f a -> Ordering #

Lift the standard compare function through the type constructor.

Since: base-4.9.0.0

class Show1 (f :: Type -> Type) #

Lifting of the Show class to unary type constructors.

Since: base-4.9.0.0

Minimal complete definition

liftShowsPrec

Instances

Instances details
Show1 []

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> [a] -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [[a]] -> ShowS #

Show1 Maybe

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Maybe a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Maybe a] -> ShowS #

Show1 Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Identity a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Identity a] -> ShowS #

Show1 Down

Since: base-4.12.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Down a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Down a] -> ShowS #

Show1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmpty a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonEmpty a] -> ShowS #

Show1 IntMap

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> IntMap a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [IntMap a] -> ShowS #

Show1 Tree

Since: containers-0.5.9

Instance details

Defined in Data.Tree

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Tree a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Tree a] -> ShowS #

Show1 Seq

Since: containers-0.5.9

Instance details

Defined in Data.Sequence.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Seq a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Seq a] -> ShowS #

Show1 Set

Since: containers-0.5.9

Instance details

Defined in Data.Set.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Set a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Set a] -> ShowS #

Show1 Hashed 
Instance details

Defined in Data.Hashable.Class

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Hashed a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Hashed a] -> ShowS #

Show1 Concrete Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Concrete a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Concrete a] -> ShowS #

Show1 Symbolic Source # 
Instance details

Defined in Hedgehog.Internal.State

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Symbolic a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Symbolic a] -> ShowS #

Show a => Show1 (Either a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Either a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Either a a0] -> ShowS #

Show a => Show1 ((,) a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> (a, a0) -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [(a, a0)] -> ShowS #

Show1 (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Proxy a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Proxy a] -> ShowS #

Show k => Show1 (Map k)

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Map k a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Map k a] -> ShowS #

Show1 m => Show1 (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> MaybeT m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [MaybeT m a] -> ShowS #

Show1 m => Show1 (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ListT m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ListT m a] -> ShowS #

Show1 m => Show1 (NodeT m) Source # 
Instance details

Defined in Hedgehog.Internal.Tree

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NodeT m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NodeT m a] -> ShowS #

Show1 m => Show1 (TreeT m) Source # 
Instance details

Defined in Hedgehog.Internal.Tree

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> TreeT m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [TreeT m a] -> ShowS #

Show a => Show1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Const a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Const a a0] -> ShowS #

(Show e, Show1 m) => Show1 (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ExceptT e m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ExceptT e m a] -> ShowS #

(Show w, Show1 m) => Show1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> WriterT w m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [WriterT w m a] -> ShowS #

(Show e, Show1 m) => Show1 (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> ErrorT e m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [ErrorT e m a] -> ShowS #

Show1 f => Show1 (IdentityT f) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> IdentityT f a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [IdentityT f a] -> ShowS #

(Show w, Show1 m) => Show1 (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> WriterT w m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [WriterT w m a] -> ShowS #

Show1 (Tagged s) 
Instance details

Defined in Data.Tagged

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Tagged s a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Tagged s a] -> ShowS #

(Show1 f, Show1 g) => Show1 (Product f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Product

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Product f g a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Product f g a] -> ShowS #

(Show1 f, Show1 g) => Show1 (Sum f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Sum

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Sum f g a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Sum f g a] -> ShowS #

(Show1 f, Show1 g) => Show1 (Compose f g)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Compose

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Compose f g a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Compose f g a] -> ShowS #

showsPrec1 :: (Show1 f, Show a) => Int -> f a -> ShowS #

Lift the standard showsPrec and showList functions through the type constructor.

Since: base-4.9.0.0

Deprecated

class HTraversable t where Source #

Deprecated: Replace with Hedgehog.TraversableB (defined in Data.Functor.Barbie) which can be derived automatically using GHC.Generics

Higher-order traversable functors.

Deprecated in favor of TraversableB which can be derived using GHC.Generics

Methods

htraverse :: Applicative f => (forall a. g a -> f (h a)) -> t g -> f (t h) Source #