This repository was 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.
EffectandEffectQueue(preferred)Effectwraps a pureSignalProduceras a side-effect, and is also aware of whichEffectQueueto be registered on.EffectQueueis anEquatableenum to identify queues, which also associates withFlattenStrategyfor flattening effects.EffectQueueprovides more flexible flattening strategies compared to previous ver0.5.0orFeedbacksystems.2.
Feedback(alternative approach found in ReactiveFeedback)Compared to ReactiveFeedback, this feature includes:
Feedbackis isomorphic toSignal<(Input, FromState, ToState)> -> Signal<Input>which efficiently calculates next input from 3-tuple instead of 1 (ToStateonly as Moore Machine) or 2-tuple (InputandFromStateas Mealy Machine).inputs(hot signals) andfeedback(cold producers)reduce.Other breaking Changes
inputssend.completed, all running side-effects will be terminated immediately rather than waiting them to send finalreplies. This behavior will be same assend(.interrupted).