This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
Refactor code by adding Effect
, EffectQueue
, Feedback
#12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings quite a lot of improvements for effect handling including a bit of breaking changes.
New Features
1.
Effect
andEffectQueue
(preferred)Effect
wraps a pureSignalProducer
as a side-effect, and is also aware of whichEffectQueue
to be registered on.EffectQueue
is anEquatable
enum to identify queues, which also associates withFlattenStrategy
for flattening effects.EffectQueue
provides more flexible flattening strategies compared to previous ver0.5.0
orFeedback
systems.2.
Feedback
(alternative approach found in ReactiveFeedback)Compared to ReactiveFeedback, this feature includes:
Feedback
is isomorphic toSignal<(Input, FromState, ToState)> -> Signal<Input>
which efficiently calculates next input from 3-tuple instead of 1 (ToState
only as Moore Machine) or 2-tuple (Input
andFromState
as Mealy Machine).inputs
(hot signals) andfeedback
(cold producers)reduce
.Other breaking Changes
inputs
send.completed
, all running side-effects will be terminated immediately rather than waiting them to send finalreplies
. This behavior will be same assend(.interrupted)
.