When constructing a tweak from an optic and a modification of foci, there are in principle two options for optics with many foci:
Apply the modification to all foci and return one modified transaction.
Generate a number of transactions that contain different combinations of modified and un-modified foci.
This PR closes #336 by defining combineModsTweak, which enables the second strategy using indexed optics. This function has an argument of type [is] -> [[is]], where is is the index type of the optic, to describe which all the sets of indices of foci from which modifications should be combined. For example,
using (:[]) :: [is] -> [[is]], we retreive the behaviour of strategy 1,
using map (:[]) :: [is] -> [[is]] amounts to saying that exactly one focus must be modified on each generated transaction,
using tail . subsequences :: [is] -> [[is]] will generate all modified transactions that contain at least one modified focus,
...
I also implemented doubleSatAttack in terms of combineModsTweak, which led to a simplification, while also increasing what it can do. (The new features are tested.)
When constructing a tweak from an optic and a modification of foci, there are in principle two options for optics with many foci:
This PR closes #336 by defining
combineModsTweak
, which enables the second strategy using indexed optics. This function has an argument of type[is] -> [[is]]
, whereis
is the index type of the optic, to describe which all the sets of indices of foci from which modifications should be combined. For example,(:[]) :: [is] -> [[is]]
, we retreive the behaviour of strategy 1,map (:[]) :: [is] -> [[is]]
amounts to saying that exactly one focus must be modified on each generated transaction,tail . subsequences :: [is] -> [[is]]
will generate all modified transactions that contain at least one modified focus,I also implemented
doubleSatAttack
in terms ofcombineModsTweak
, which led to a simplification, while also increasing what it can do. (The new features are tested.)