HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulehspec-hedgehog-0.3.0.0Haskell2010

Test.Hspec.Hedgehog

This module allows you to easily integrate the Hedgehog library with Test.Hspec test-suites.

To get started, check out the hedgehog function, which lets you embed a PropertyT directly.

spec :: Spec
spec =
  describe "my great test" $ do
    it "generates stuff" $
      hedgehog $ do
        a <- forAll generator
        a === expected

Truth be told, the functionality is in the two orphan instances of Example for PropertyT. You can directly use code in the PropertyT IO type. However, because most Hedgehog functions are abstract in MonadTest, you might get errors about ambiguous types. The hedgehog function fixes the type to PropertyT IO (), which works out just fine.

You can use all of hspec's hooks with this, of course.

spec :: Spec
spec = before (pure "Hello!") $ do
  describe "with a string" $ do
    it "gets a string" $ \ str ->
      hedgehog $ do
        wrongLen <- forAll $ Gen.integral (Range.linear 0 3)
        length str /== wrongLen

The function before will make all the following spec items a function, accepting that as a parameter. You should call hedgehog after the lambda.

If you are morally opposed to the pattern:

it "message" $ hedgehog $ do
  True === False

Then you can alternatively force the type some other way. One option is to use a no-op function, like this:

it "message" $ do
  pure () :: PropertyT IO ()
  True === False

This style has the advantage that parameters via hooks are less difficult to get right.

before (pure "Hello!") $ do
  it "message" $ \str -> do
    pure () :: PropertyT IO ()
    wrongLen <- forAll $ Gen.integral (Range.linear 0 3)
    length str /== wrongLen

You don't have to remember to put the hedgehog call after the lambda.

  • 29 types
  • 8 classes
  • 55 values

The Main Function

1 declaration

Hspec re-exports

4 declarations

modifyMaxSize isn't re-exported, since hedgehog has nothing that corresponds to it.

Hedgehog Re-exports

89 declarations
valuelabel :: (MonadTest m, HasCallStack) => LabelName -> m ()
#

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

datadata Property
#

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

newtypenewtype DiscardLimit
#

The number of discards to allow before giving up.

Can be constructed using numeric literals:

  10000 :: DiscardLimit
Instances8Enum, Eq, Integral, Num, Ord, Real, …
newtypenewtype ShrinkLimit
#

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

Can be constructed using numeric literals:

  1000 :: ShrinkLimit
Instances8Enum, Eq, Integral, Num, Ord, Real, …
newtypenewtype TestLimit
#

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
Instances8Enum, Eq, Integral, Num, Ord, Real, …
  • Enum TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Eq TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Integral TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Num TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Ord TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Real TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Show TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Lift TestLimitDefined in hedgehog-1.7 · Hedgehog.Internal.Property
datadata Seed
#

A splittable random number generator.

Constructors

Instances6Eq, Ord, Read, Show, RandomGen, Lift
  • Eq SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
  • Ord SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
  • Read SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
  • Show SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
  • RandomGen SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
  • Lift SeedDefined in hedgehog-1.7 · Hedgehog.Internal.Seed
newtypenewtype PropertyT (m :: Type -> Type) a
#

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

Instances27MonadTrans, MonadTransDistributive, MFunctor, MonadError, MonadReader, MonadState, …
methoddistributeT :: Transformer f g m => g (f m) a -> f (g m) a
#

Distribute one monad transformer over another.

classclass (Monad m, Monad (GenBase m)) => MonadGen (m :: Type -> Type) where
#

Class of monads which can generate input data for tests.

Associated types

Methods

Instances9MonadGen, …
familytype family GenBase (m :: Type -> Type) :: Type -> Type
#
Instances9GenBase, …
newtypenewtype GenT (m :: Type -> Type) a
#

Monad transformer which can generate random values of a.

Instances28MonadTrans, MMonad, MonadTransDistributive, MFunctor, MonadError, MonadReader, …
classclass HTraversable (t :: (Type -> Type) -> Type) where
#

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

newtypenewtype Opaque a
#

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

Instances3Eq, Ord, Show
  • Eq a => Eq (Opaque a)Defined in hedgehog-1.7 · Hedgehog.Internal.Opaque
  • Ord a => Ord (Opaque a)Defined in hedgehog-1.7 · Hedgehog.Internal.Opaque
  • Show (Opaque a)Defined in hedgehog-1.7 · Hedgehog.Internal.Opaque
newtypenewtype Confidence
#

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.

Instances5Eq, Num, Ord, Show, Lift
  • Eq ConfidenceDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Num ConfidenceDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Ord ConfidenceDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Show ConfidenceDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Lift ConfidenceDefined in hedgehog-1.7 · Hedgehog.Internal.Property
newtypenewtype GroupName
#

The name of a group of properties.

Should be constructed using OverloadedStrings:

  "fruit" :: GroupName
Instances6Eq, Ord, Show, IsString, Semigroup, Lift
newtypenewtype LabelName
#

The name of a classifier.

Should be constructed using OverloadedStrings:

  "apples" :: LabelName
Instances6Eq, Ord, Show, IsString, Semigroup, Monoid
classclass Monad m => MonadTest (m :: Type -> Type) where
#

Methods

Instances14MonadTest, …
newtypenewtype PropertyName
#

The name of a property.

Should be constructed using OverloadedStrings:

  "apples" :: PropertyName
Instances6Eq, Ord, Show, IsString, Semigroup, Lift
newtypenewtype ShrinkRetries
#

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
Instances8Enum, Eq, Integral, Num, Ord, Real, …
datadata Skip
#

Where to start running a property's tests.

Instances5Eq, Ord, Show, IsString, Lift
  • Eq SkipDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Ord SkipDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • Show SkipDefined in hedgehog-1.7 · Hedgehog.Internal.Property
  • IsString SkipDefined in hedgehog-1.7 · Hedgehog.Internal.Property

    We use this instance to support usage like

      withSkip "3:aB"
    

    It throws an error if the input is not a valid compressed Skip.

  • Lift SkipDefined in hedgehog-1.7 · Hedgehog.Internal.Property
newtypenewtype TestT (m :: Type -> Type) a
#

A test monad transformer allows the assertion of expectations.

Instances23MonadTrans, MonadTransControl, MonadTransDistributive, MFunctor, MonadError, MonadReader, …
valueclassify :: (MonadTest m, HasCallStack) => LabelName -> Bool -> m ()
#

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

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.

valuediff
  1. :: (MonadTest m, Show a, Show b, HasCallStack)
  2. => a
  3. -> a -> b -> Bool
  4. -> b
  5. -> m ()
#

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.

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

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

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

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.

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

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.

valuefootnote :: MonadTest m => String -> m ()
#

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

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

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

valueforAllWith
  1. :: (Monad m, HasCallStack)
  2. => a -> String
  3. -> Gen a
  4. -> PropertyT m a
#

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.

valuetest :: Monad m => TestT m a -> PropertyT m a
#

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.

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.

datadata Range a
#

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.

Instances1Functor
  • Functor RangeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
newtypenewtype Size
#

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

Instances8Enum, Eq, Integral, Num, Ord, Read, …
  • Enum SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Eq SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Integral SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Num SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Ord SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Read SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Real SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
  • Show SizeDefined in hedgehog-1.7 · Hedgehog.Internal.Range
valuecheckParallel :: MonadIO m => Group -> m Bool
#

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)
    ]
valuecheckSequential :: MonadIO m => Group -> m Bool
#

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)
    ]
datadata Action (m :: Type -> Type) (state :: (Type -> Type) -> Type)
#

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

Instances1Show
  • Show (Action m state)Defined in hedgehog-1.7 · Hedgehog.Internal.State
datadata Callback (input :: (Type -> Type) -> Type) output (state :: (Type -> Type) -> Type)
#

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 :: Type -> Type). 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.

datadata Command (gen :: Type -> Type) (m :: Type -> Type) (state :: (Type -> Type) -> Type)
#

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

newtypenewtype Concrete a where
#

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

Instances9Functor, Foldable, Traversable, Eq1, Ord1, Show1, …
datadata Symbolic a where
#

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

Instances6Eq1, Ord1, Show1, Eq, Ord, Show
  • Eq1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Ord1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Show1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Eq (Symbolic a)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • Ord (Symbolic a)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • Show (Symbolic a)Defined in hedgehog-1.7 · Hedgehog.Internal.State
newtypenewtype Var a (v :: Type -> Type)
#

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 FunctorB and TraversableB, which is how Symbolic values are turned into Concrete ones.

Constructors

Instances5FunctorB, TraversableB, Eq, Ord, Show
  • FunctorB (Var a)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • TraversableB (Var a)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • (Eq a, Eq1 v) => Eq (Var a v)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • (Ord a, Ord1 v) => Ord (Var a v)Defined in hedgehog-1.7 · Hedgehog.Internal.State
  • (Show a, Show1 v) => Show (Var a v)Defined in hedgehog-1.7 · Hedgehog.Internal.State
valuediscover :: TExpQ Group
#

Discover all the properties in a module.

Functions starting with prop_ are assumed to be properties.

valuetripping
  1. :: (MonadTest m, Applicative f, Show b, Show (f a), Eq (f a), HasCallStack)
  2. => a
  3. -> a -> b
  4. -> b -> f a
  5. -> m ()
#

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
valueeq1 :: (Eq1 f, Eq a) => f a -> f a -> Bool
#

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

classclass 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.

Methods

  • bmap :: (forall (a :: k). f a -> g a) -> b f -> b g
Instances11FunctorB, …
classclass 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 Data.Functor.Identity = Data.Functor.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.

Methods

Instances11TraversableB, …
newtypenewtype Rec p a (x :: k)
#

Constructors

Instances45GTraversable, GApplicative, GFunctor, GDistributive, GBare, GConstraints, …
classclass (forall a. Eq a => Eq (f a)) => Eq1 (f :: Type -> Type) where
#

Lifting of the Eq class to unary type constructors.

Any instance should be subject to the following law that canonicity is preserved:

liftEq (==) = (==)

This class therefore represents the generalization of Eq by decomposing its main method into a canonical lifting on a canonical inner method, so that the lifting can be reused for other arguments than the canonical one.

Instances67Lifting2, Lifting, Eq1, …
  • Eq1 ComplexDefined in base-4.20.2.0 · Data.Functor.Classes
    Example1 expression
    eq1 (1 :+ 2) (1 :+ 2)True
    Example1 expression
    eq1 (1 :+ 2) (1 :+ 3)False
  • Eq1 SCCDefined in containers-0.7 · Data.Graph
  • Eq1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Eq1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Eq1 SetDefined in containers-0.7 · Data.Set.Internal
  • Eq1 TreeDefined in containers-0.7 · Data.Tree
  • Eq1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 IdentityDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 DownDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 Par1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 MaybeDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 SoloDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 HashedDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Eq1 ConcreteDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Eq1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Eq1 ArrayDefined in primitive-0.9.1.0 · Data.Primitive.Array
  • Eq1 SmallArrayDefined in primitive-0.9.1.0 · Data.Primitive.SmallArray
  • Eq1 []Defined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 ProxyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 U1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UAddrDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UCharDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UDoubleDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UFloatDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UIntDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 UWordDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 V1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 f => Eq1 (Lift f)Defined in transformers-0.6.1.1 · Control.Applicative.Lift
  • Eq1 m => Eq1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe
  • Eq a => Eq1 (Either a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Eq a => Eq1 (Tuple2 a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Eq k => Eq1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • (GEq1 NonV4 (Rep1 f), Generic1 f) => Eq1 (FunctorClassesDefault f)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.Internal
  • Eq1 (Tagged s)Defined in tagged-0.8.9 · Data.Tagged
  • Eq1 f => Eq1 (Rec1 f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Eq1 f => Eq1 (Backwards f)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards
  • Eq1 f => Eq1 (IdentityT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity
  • Eq1 f => Eq1 (Reverse f)Defined in transformers-0.6.1.1 · Data.Functor.Reverse
  • Eq a => Eq1 (Const a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Eq a => Eq1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.Constant
  • (Generic1 f, Eq1 (Rep1 f)) => Eq1 (Generically1 f)Defined in base-4.20.2.0 · Data.Functor.Classes
  • (Eq a, Eq b) => Eq1 (Tuple3 a b)Defined in base-4.20.2.0 · Data.Functor.Classes
  • (Eq e, Eq1 m) => Eq1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except
  • (Eq w, Eq1 m) => Eq1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy
  • (Eq w, Eq1 m) => Eq1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict
  • Lifting Eq1 LiftDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Eq1 MaybeTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Eq1 BackwardsDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Eq1 IdentityTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Eq1 ReverseDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq e => Lifting Eq1 (ExceptT e)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq w => Lifting Eq1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq w => Lifting Eq1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Eq1 ProductDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Eq1 SumDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq1 f => Lifting Eq1 (Product f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq1 f => Lifting Eq1 (Sum f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq1 f => Lifting Eq1 (Compose f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Eq c => Eq1 (K1 i c)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Eq1 f, Eq1 g) => Eq1 (Product f g)Defined in base-4.20.2.0 · Data.Functor.Product
  • (Eq1 f, Eq1 g) => Eq1 (Sum f g)Defined in base-4.20.2.0 · Data.Functor.Sum
  • (Eq1 f, Eq1 g) => Eq1 (f :*: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Eq1 f, Eq1 g) => Eq1 (f :+: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Eq a, Eq b, Eq c) => Eq1 (Tuple4 a b c)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Eq1 f => Eq1 (M1 i c f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Eq1 f, Eq1 g) => Eq1 (Compose f g)Defined in base-4.20.2.0 · Data.Functor.Compose
  • (Eq1 f, Eq1 g) => Eq1 (f :.: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
classclass (Eq1 f, forall a. Ord a => Ord (f a)) => Ord1 (f :: Type -> Type) where
#

Lifting of the Ord class to unary type constructors.

Any instance should be subject to the following law that canonicity is preserved:

liftCompare compare = compare

This class therefore represents the generalization of Ord by decomposing its main method into a canonical lifting on a canonical inner method, so that the lifting can be reused for other arguments than the canonical one.

Instances65Lifting2, Lifting, Ord1, …
  • Ord1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Ord1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Ord1 SetDefined in containers-0.7 · Data.Set.Internal
  • Ord1 TreeDefined in containers-0.7 · Data.Tree
  • Ord1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 IdentityDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 DownDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 Par1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 MaybeDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 SoloDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 HashedDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Ord1 ConcreteDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Ord1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Ord1 ArrayDefined in primitive-0.9.1.0 · Data.Primitive.Array
  • Ord1 SmallArrayDefined in primitive-0.9.1.0 · Data.Primitive.SmallArray
  • Ord1 []Defined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 ProxyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 U1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UAddrDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UCharDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UDoubleDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UFloatDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UIntDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 UWordDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 V1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 f => Ord1 (Lift f)Defined in transformers-0.6.1.1 · Control.Applicative.Lift
  • Ord1 m => Ord1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe
  • Ord a => Ord1 (Either a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Ord a => Ord1 (Tuple2 a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Ord k => Ord1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • (GOrd1 NonV4 (Rep1 f), Generic1 f) => Ord1 (FunctorClassesDefault f)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.Internal
  • Ord1 (Tagged s)Defined in tagged-0.8.9 · Data.Tagged
  • Ord1 f => Ord1 (Rec1 f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Ord1 f => Ord1 (Backwards f)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards
  • Ord1 f => Ord1 (IdentityT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity
  • Ord1 f => Ord1 (Reverse f)Defined in transformers-0.6.1.1 · Data.Functor.Reverse
  • Ord a => Ord1 (Const a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Ord a => Ord1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.Constant
  • (Generic1 f, Ord1 (Rep1 f)) => Ord1 (Generically1 f)Defined in base-4.20.2.0 · Data.Functor.Classes
  • (Ord a, Ord b) => Ord1 (Tuple3 a b)Defined in base-4.20.2.0 · Data.Functor.Classes
  • (Ord e, Ord1 m) => Ord1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except
  • (Ord w, Ord1 m) => Ord1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy
  • (Ord w, Ord1 m) => Ord1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict
  • Lifting Ord1 LiftDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Ord1 MaybeTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Ord1 BackwardsDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Ord1 IdentityTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Ord1 ReverseDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord e => Lifting Ord1 (ExceptT e)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord w => Lifting Ord1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord w => Lifting Ord1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Ord1 ProductDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Ord1 SumDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord1 f => Lifting Ord1 (Product f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord1 f => Lifting Ord1 (Sum f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord1 f => Lifting Ord1 (Compose f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Ord c => Ord1 (K1 i c)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Ord1 f, Ord1 g) => Ord1 (Product f g)Defined in base-4.20.2.0 · Data.Functor.Product
  • (Ord1 f, Ord1 g) => Ord1 (Sum f g)Defined in base-4.20.2.0 · Data.Functor.Sum
  • (Ord1 f, Ord1 g) => Ord1 (f :*: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Ord1 f, Ord1 g) => Ord1 (f :+: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Ord a, Ord b, Ord c) => Ord1 (Tuple4 a b c)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Ord1 f => Ord1 (M1 i c f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Ord1 f, Ord1 g) => Ord1 (Compose f g)Defined in base-4.20.2.0 · Data.Functor.Compose
  • (Ord1 f, Ord1 g) => Ord1 (f :.: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
classclass (forall a. Show a => Show (f a)) => Show1 (f :: Type -> Type) where
#

Lifting of the Show class to unary type constructors.

Any instance should be subject to the following laws that canonicity is preserved:

liftShowsPrec showsPrec showList = showsPrec

liftShowList showsPrec showList = showList

This class therefore represents the generalization of Show by decomposing it's methods into a canonical lifting on a canonical inner method, so that the lifting can be reused for other arguments than the canonical one.

Instances69Lifting2, Lifting, Show1, …
  • Show1 ComplexDefined in base-4.20.2.0 · Data.Functor.Classes
    Example1 expression
    showsPrec1 0 (2 :+ 3) """2 :+ 3"
  • Show1 SCCDefined in containers-0.7 · Data.Graph
  • Show1 IntMapDefined in containers-0.7 · Data.IntMap.Internal
  • Show1 SeqDefined in containers-0.7 · Data.Sequence.Internal
  • Show1 SetDefined in containers-0.7 · Data.Set.Internal
  • Show1 TreeDefined in containers-0.7 · Data.Tree
  • Show1 NonEmptyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 IdentityDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 DownDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 Par1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 MaybeDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 SoloDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 HashedDefined in hashable-1.4.7.0 · Data.Hashable.Class
  • Show1 ConcreteDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Show1 SymbolicDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Show1 ArrayDefined in primitive-0.9.1.0 · Data.Primitive.Array
  • Show1 SmallArrayDefined in primitive-0.9.1.0 · Data.Primitive.SmallArray
  • Show1 []Defined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 ProxyDefined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 U1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UAddrDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UCharDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UDoubleDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UFloatDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UIntDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 UWordDefined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 V1Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 f => Show1 (Lift f)Defined in transformers-0.6.1.1 · Control.Applicative.Lift
  • Show1 m => Show1 (NodeT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Tree
  • Show1 m => Show1 (TreeT m)Defined in hedgehog-1.7 · Hedgehog.Internal.Tree
  • Show1 m => Show1 (MaybeT m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Maybe
  • Show a => Show1 (Either a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Show a => Show1 (Tuple2 a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Show k => Show1 (Map k)Defined in containers-0.7 · Data.Map.Internal
  • (GShow1 NonV4 (Rep1 f), Generic1 f) => Show1 (FunctorClassesDefault f)Defined in transformers-compat-0.7.2 · Data.Functor.Classes.Generic.Internal
  • Show1 (Dict c)Defined in barbies-2.1.1.0 · Barbies.Internal.Dicts
  • Show1 (Tagged s)Defined in tagged-0.8.9 · Data.Tagged
  • Show1 f => Show1 (Rec1 f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • Show1 f => Show1 (Backwards f)Defined in transformers-0.6.1.1 · Control.Applicative.Backwards
  • Show1 f => Show1 (IdentityT f)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Identity
  • Show1 f => Show1 (Reverse f)Defined in transformers-0.6.1.1 · Data.Functor.Reverse
  • Show a => Show1 (Const a)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Show a => Show1 (Constant a)Defined in transformers-0.6.1.1 · Data.Functor.Constant
  • (Show a, Show b) => Show1 (Tuple3 a b)Defined in base-4.20.2.0 · Data.Functor.Classes
  • (Show e, Show1 m) => Show1 (ExceptT e m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Except
  • (Show w, Show1 m) => Show1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Lazy
  • (Show w, Show1 m) => Show1 (WriterT w m)Defined in transformers-0.6.1.1 · Control.Monad.Trans.Writer.Strict
  • Lifting Show1 LiftDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Show1 MaybeTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Show1 BackwardsDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Show1 IdentityTDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting Show1 ReverseDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show e => Lifting Show1 (ExceptT e)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show w => Lifting Show1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show w => Lifting Show1 (WriterT w)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Show1 ProductDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Lifting2 Show1 SumDefined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show1 f => Lifting Show1 (Product f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show1 f => Lifting Show1 (Sum f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show1 f => Lifting Show1 (Compose f)Defined in constraints-0.14.2 · Data.Constraint.Lifting
  • Show c => Show1 (K1 i c)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Show1 f, Show1 g) => Show1 (Product f g)Defined in base-4.20.2.0 · Data.Functor.Product
  • (Show1 f, Show1 g) => Show1 (Sum f g)Defined in base-4.20.2.0 · Data.Functor.Sum
  • (Show1 f, Show1 g) => Show1 (f :*: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Show1 f, Show1 g) => Show1 (f :+: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Show a, Show b, Show c) => Show1 (Tuple4 a b c)Defined in base-4.20.2.0 · Data.Functor.Classes
  • Show1 f => Show1 (M1 i c f)Defined in base-orphans-0.9.3 · Data.Orphans · orphan
  • (Show1 f, Show1 g) => Show1 (Compose f g)Defined in base-4.20.2.0 · Data.Functor.Compose
  • (Show1 f, Show1 g) => Show1 (f :.: g)Defined in base-orphans-0.9.3 · Data.Orphans · orphan

Orphan instances

2 instances
  • m ~ IO => Example (PropertyT m ())

    Warning: Orphan instance! This instance is used to embed a Hedgehog property seamlessly into the hspec framework. See the other instance of Example for a function for more details.

  • m ~ IO => Example (a -> PropertyT m ())

    Warning: orphan instance! This instance is used to embed a Hedgehog property seamlessly into the hspec framework.

    The instance will pick things up from the Test.Hspec.QuickCheck configuration. For example, if the program is supposed to use a predetermined seed, then the same seed will be used for QuickCheck and Hedgehog tests.