HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehedgehog-1.7Haskell2010

Hedgehog.Internal.State

  • 11 types
  • 15 values
  • Packagehedgehog-1.7
  • Exports26
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceState.hs

Variables

6 declarations
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
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

Constructors

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 Name
#

Symbolic variable names.

Constructors

Instances4Eq, Num, Ord, Show
  • Eq NameDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Num NameDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Ord NameDefined in hedgehog-1.7 · Hedgehog.Internal.State
  • Show NameDefined in hedgehog-1.7 · Hedgehog.Internal.State

Environment

7 declarations

Commands

2 declarations
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

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.

Actions

11 declarations
datadata Action (m :: Type -> Type) (state :: (Type -> Type) -> Type)
#

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

Constructors

Instances1Show
  • Show (Action m state)Defined in hedgehog-1.7 · Hedgehog.Internal.State