seq package:hedgehog

Generates a seq using a Range to determine the length.
The sequence of actions.
Generates a sequence of actions from an initial model state and set of commands.
Evaluate each monadic action in the structure from left to right, and collect the results. For a version that ignores the results see sequence_.

Examples

Basic usage: The first two examples are instances where the input and and output of sequence are isomorphic.
>>> sequence $ Right [1,2,3,4]
[Right 1,Right 2,Right 3,Right 4]
>>> sequence $ [Right 1,Right 2,Right 3,Right 4]
Right [1,2,3,4]
The following examples demonstrate short circuit behavior for sequence.
>>> sequence $ Left [1,2,3,4]
Left [1,2,3,4]
>>> sequence $ [Left 0, Right 1,Right 2,Right 3,Right 4]
Left 0
Evaluate each action in the structure from left to right, and collect the results. For a version that ignores the results see sequenceA_.

Examples

Basic usage: For the first two examples we show sequenceA fully evaluating a a structure and collecting the results.
>>> sequenceA [Just 1, Just 2, Just 3]
Just [1,2,3]
>>> sequenceA [Right 1, Right 2, Right 3]
Right [1,2,3]
The next two example show Nothing and Just will short circuit the resulting structure if present in the input. For more context, check the Traversable instances for Either and Maybe.
>>> sequenceA [Just 1, Just 2, Just 3, Nothing]
Nothing
>>> sequenceA [Right 1, Right 2, Right 3, Left 4]
Left 4
Evaluate each monadic action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results see sequence. sequence_ is just like sequenceA_, but specialised to monadic actions.
A sequence of actions to execute.
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)
]
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.
Generates a random subsequence of a list. For example:
Gen.print (Gen.subsequence [1..5])
=== Outcome ===
[1,2,4]
=== Shrinks ===
[]
[2,4]
[1,4]
[1,2]
Generates a random permutation of a sequence. This shrinks towards the order of the sequence being identical to the input sequence.