byron-spec-ledger-1.0.1.0: Executable specification of Cardano ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Byron.Spec.Ledger.UTxO.Generators

Synopsis

Documentation

genInitialTxOuts ∷ [Addr] → Gen [TxOut] Source #

Generate a set of initial TxOuts from a set of Addrs

genTraverseSubsequence ∷ (a → Gen b) → [a] → Gen [b] Source #

Generate a subsequence of a list of values and traverse the subsequence with a generator producer

genListRange IntGen a → Gen [a] Source #

Generate a list using genTraverseSubsequence

interleaveTreeTMonad m ⇒ [TreeT m a] → m (NodeT m [a]) Source #

Temporarily defined here until hedgehog exposes this function

genTxFromUTxO Source #

Arguments

∷ [Addr]

List of addresses to choose from as recipients of the transaction outputs.

→ (TxLovelace)

Fee calculation

UTxO

UTxO used to determine which unspent outputs can be used in the transaction.

Gen Tx 

Generate a valid transaction from a given UTxO

propGenInputOutputProperty Source #

A property to test that the entire shrink tree generated by genInputOutput maintains the invariant that the inputs and outputs have equal sums

NB: This uses small values for the list and values, because we force the entire shrink tree, which can grow very large

genInputOutput Source #

Arguments

∷ [input]

List of input to take a subsequence of

→ (input → Integer)

A view of the value in the input used to preserve the invariant

Gen (Integer → output)

A applicative generator for an output given a value

→ (output → Integer)

A view of the value in the output used to preserve the invariant

→ ((IntegerInteger) → output → output)

An update function for the output value used to preserve the invariant

Gen ([input], [output]) 

Generate a subsequence of the inputs and split the value into a number of outputs

The shrink tree maintains the invariant that the sum of the inputs is equal to the sum of the outputs. This is generalised to any type of input where we can view the contained value, and type of output where we can generate the type from a value, and view and modify the contained value

interleaveInputOutputTreeTMonad m ⇒ (input → Integer) → (output → Integer) → ((IntegerInteger) → output → output) → (TreeT m [input], TreeT m [output]) → m (NodeT m ([input], [output])) Source #

Used as part of genInputOutput, so see there for details of the arguments

interleaveInputOutputMonad m ⇒ (input → Integer) → (output → Integer) → ((IntegerInteger) → output → output) → (NodeT m [input], NodeT m [output]) → NodeT m ([input], [output]) Source #

Used as part of genInputOutput, so see there for details of the arguments

shrinkRightMonad m ⇒ (input → Integer) → (output → Integer) → ((IntegerInteger) → output → output) → (NodeT m [input], NodeT m [output]) → [TreeT m ([input], [output])] Source #

Used as part of genInputOutput, so see there for details of the arguments

shrinkLeftPreservingMonad m ⇒ (input → Integer) → (output → Integer) → ((IntegerInteger) → output → output) → (NodeT m [input], NodeT m [output]) → [TreeT m ([input], [output])] Source #

Shrink the left value of a tuple, preserving the total value stored in the right value

Used as part of genInputOutput, so see there for details of the arguments

subFromList Source #

Arguments

∷ (Num n, Ord n) 
⇒ n

The total value to remove from the list

→ (a → n)

A view into the value contained in type a

→ ((n → n) → a → a)

A modifier for the value contained in type a

→ [a]

The list of as to remove value from

→ [a] 

Remove total value from a list, removing from the front

propGenSplitValueProperty Source #

A property to check that genSplitValue does indeed preserve the input

genSplitValue Source #

Arguments

Integer

Total value to divide into outputs

Gen (Integer → a)

Applicative generator for an output given a value

→ (a → Integer)

A view of the value in the output used to preserve the invariant

→ ((IntegerInteger) → a → a)

A modifier for the value in the output used to preserve the invariant

Gen [a] 

Given an input value and functions to generate, view, and update some type a based on that value, split the input into a number of as, preserving the value throughout the shrink tree

interleaveTreeTPreservingMonad m ⇒ (a → Integer) → ((IntegerInteger) → a → a) → [TreeT m a] → m (NodeT m [a]) Source #

Used as part of genSplitValue, so see there for details of the arguments

interleavePreservingMonad m ⇒ (a → Integer) → ((IntegerInteger) → a → a) → [NodeT m a] → NodeT m [a] Source #

Used as part of genSplitValue, so see there for details of the arguments

dropOnePreservingMonad m ⇒ (a → Integer) → ((IntegerInteger) → a → a) → [NodeT m a] → [TreeT m [a]] Source #

Drop one of the outputs, preserving the invariant by moving its value to the left

Used as part of genSplitValue, so see there for details of the arguments

shrinkOnePreservingMonad m ⇒ (a → Integer) → ((IntegerInteger) → a → a) → [NodeT m a] → [TreeT m [a]] Source #

Shrink a value in a list, preserving the total value by moving the lost value to the left

Used as part of genSplitValue, so see there for details of the arguments

viewTwo ∷ [a] → [([a], a, a, [a])] Source #

All the ways of choosing two consecutive values from a list