HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulebyron-spec-ledger-1.1.0.1Haskell2010

Byron.Spec.Ledger.UTxO.Generators

  • 20 values
valuegenTraverseSubsequence :: (a -> Gen b) -> [a] -> Gen [b]
#

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

valuegenTxFromUTxO
  1. :: [Addr]

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

  2. -> (Tx -> Lovelace)

    Fee calculation

  3. -> UTxO

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

  4. -> Gen Tx
#

Generate a valid transaction from a given UTxO

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

valuegenInputOutput
  1. :: [input]

    List of input to take a subsequence of

  2. -> (input -> Integer)

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

  3. -> Gen (Integer -> output)

    A applicative generator for an output given a value

  4. -> (output -> Integer)

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

  5. -> ((Integer -> Integer) -> output -> output)

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

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

valuesubFromList
  1. :: (Num n, Ord n)
  2. => n

    The total value to remove from the list

  3. -> (a -> n)

    A view into the value contained in type a

  4. -> ((n -> n) -> a -> a)

    A modifier for the value contained in type a

  5. -> [a]

    The list of as to remove value from

  6. -> [a]
#

Remove total value from a list, removing from the front

valuegenSplitValue
  1. :: Integer

    Total value to divide into outputs

  2. -> Gen (Integer -> a)

    Applicative generator for an output given a value

  3. -> (a -> Integer)

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

  4. -> ((Integer -> Integer) -> a -> a)

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

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

valueviewTwo :: [a] -> [([a], a, a, [a])]
#

All the ways of choosing two consecutive values from a list