| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.MockChain.Tweak
Description
This module applies the Tweak effect for the purpose
of modifying transaction skeleton before sending them for validation.
Synopsis
- reinterpretMockChainWriteWithTweak :: forall tweakEffs effs a. (Members '[ModifyLocally (UntypedTweak tweakEffs), NonDet] effs, Subsume tweakEffs effs) => Sem (MockChainWrite : effs) a -> Sem (MockChainWrite : effs) a
- type TypedTweak tweakEffs a = Sem (Tweak : (NonDet : tweakEffs)) a
- data UntypedTweak tweakEffs where
- UntypedTweak :: TypedTweak tweakEffs a -> UntypedTweak tweakEffs
- somewhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a
- everywhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a
- nowhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a
- whenAble :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a
- there :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => Integer -> TypedTweak tweakEffs b -> Sem effs a -> Sem effs a
- withTweak :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => Sem effs a -> TypedTweak tweakEffs b -> Sem effs a
Modifying mockchain runs using tweaks
reinterpretMockChainWriteWithTweak :: forall tweakEffs effs a. (Members '[ModifyLocally (UntypedTweak tweakEffs), NonDet] effs, Subsume tweakEffs effs) => Sem (MockChainWrite : effs) a -> Sem (MockChainWrite : effs) a Source #
Reinterpretes MockChainWrite in itself, when the ModifyLocally effect
exists in the stack, applying the relevant modifications in the process.
Typed and Untyped tweaks geared for TxSkel
data UntypedTweak tweakEffs where Source #
Wrapping up typed tweaks to existentially quantify on their return type
Constructors
| UntypedTweak :: TypedTweak tweakEffs a -> UntypedTweak tweakEffs |
Instances
| RunnableMockChain FullEffs Source # | |
Defined in Cooked.MockChain.Instances Methods runMockChain :: MockChainState -> Sem FullEffs a -> [RawMockChainReturn a] Source # | |
| InterpretAlone extraEff => RunnableMockChain (ExtendedStagedEffs extraEff) Source # | |
Defined in Cooked.MockChain.Instances Methods runMockChain :: MockChainState -> Sem (ExtendedStagedEffs extraEff) a -> [RawMockChainReturn a] Source # | |
Modalities to deploy UntypedTweaks on time
somewhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a Source #
Applies a Tweak to every step in a trace where it is applicable,
branching at any such locations. The tweak must apply at least once.
everywhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a Source #
Applies a Tweak to every transaction in a given trace. Fails if the tweak
fails anywhere in the trace.
nowhere :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a Source #
Ensures a given Tweak can never successfully be applied in a computation,
and leaves the computation unchanged.
whenAble :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => TypedTweak tweakEffs b -> Sem effs a -> Sem effs a Source #
Apply a given Tweak at every location in a computation where it does not
fail, which might never occur.
there :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => Integer -> TypedTweak tweakEffs b -> Sem effs a -> Sem effs a Source #
withTweak :: Members '[ModifyGlobally (UntypedTweak tweakEffs)] effs => Sem effs a -> TypedTweak tweakEffs b -> Sem effs a Source #
Apply a Tweak to the next transaction in the given trace. The order of
arguments enables an idiom like
do ... endpoint arguments `withTweak` someModification ...
where endpoint builds and validates a single transaction depending on the
given arguments. Then withTweak says "I want to modify the transaction
returned by this endpoint in the following way".