| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.Tweak.OutPermutations
Contents
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
- data PermutOutTweakMode
- = KeepIdentity (Maybe Int)
- | OmitIdentity (Maybe Int)
- allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m ()
- singleOutPermutTweak :: MonadTweak m => Int -> m ()
- distinctPermutations :: Eq a => [a] -> [[a]]
Documentation
data PermutOutTweakMode Source #
Output permutation policy
Constructors
| KeepIdentity (Maybe Int) | |
| OmitIdentity (Maybe Int) |
allOutPermutsTweak :: MonadTweak m => PermutOutTweakMode -> m () Source #
Modify transactions by changing the ordering of output constraints. If the
PermutOutTweakMode 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 #
This ensures duplicate entries in the input list don't give rise to duplicate permutations.