cooked-validators-4.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Tweak.OutPermutations

Description

This module provides tweaks to modify the order of outputs in a transaction skeleton. This can be useful since some validators expect a certain rigid output order to make sense of them.

Synopsis

Documentation

allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m () Source #

Modify transactions by changing the ordering of output constraints. If the PermutTweakMode is

  • KeepIdentity (Just n), the unmodified transaction is included in the list of modified transactions and only the first n outputs are permuted,
  • KeepIdentity Nothing, the unmodified transaction is included and all outputs are permuted. Use this with care; there might be a lot of permutations!
  • OmitIdentity (Just n), the unmodified transaction is not included in the list of modified transactions and only the first n outputs are permuted,
  • OmitIdentity Nothing, the unmodified transaction is not included and all outputs are permuted. Use this with care; there might be a lot of permutations!

(In particular, this is clever enough to generate only the distinct permutations, even if some outputs are identical.)

singleOutPermutTweak :: MonadTweak m => Int -> m () Source #

This randomly permutes the outputs of a transaction with a given seed Can be used to assess if a certain validator is order-dependant

For testing purposes

distinctPermutations :: Eq a => [a] -> [[a]] Source #