Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use effects for actions #34

Merged
merged 5 commits into from
Sep 30, 2023
Merged

Use effects for actions #34

merged 5 commits into from
Sep 30, 2023

Conversation

pipex
Copy link
Collaborator

@pipex pipex commented Sep 27, 2023

This PR introduces the Effect type to deal with asynchronous computations performed by actions returned from primitive tasks.

The Effect type is a mix between a promise, a function and an
observable. It provides a way to combine an async computation with a
sync version which "simulates" the effect that the async computation
will have on the underlying system. These types are also composable via
map and flatMap, which would allow building more complex effects
from simpler ones, however this is outside the scope of the current PR
(see PR #33 for a use of those ideas).

This PR changes the Action type to return effects instead of a Promise
which makes all actions observable by default, while keeping the action result
awaitable. This change is compatible with the existing API

Change-type: minor

This is unrelated to the PR but the eslint LSP is buggy and slows down
my editor.

Change-type: patch
Observables now are composable via `map` and `flatMap`, they can also
now accept async iterators as input, which should simplify the way
sensors and action observables are defined.

Change-type: minor
The `Effect` type is a mix between a promise, a function and an
observable. It provides a way to combine an async computation with a
sync version which "simulates" the effect that the async computation
will have on the underlying system. These types are also composable via
`map` and `flatMap`, which would allow building more complex effects
from simpler ones, however this is outside the scope of the current PR
(see PR #33 for a use of those ideas).

Change-type: minor
Actions obtained from primitive tasks now return an Effect by default,
making them both awaitable and observable. This change is compatible
with the existing API

Change-type: minor
Changing the task definition also changed the Ids defined for tasks,
thus breaking Mermaid tests. This fixes the test suite

Change-type: patch
@pipex pipex force-pushed the use-effects-for-actions branch from cb19a29 to 816f71e Compare September 27, 2023 15:48
@flowzone-app flowzone-app bot enabled auto-merge September 27, 2023 15:51
@pipex
Copy link
Collaborator Author

pipex commented Sep 30, 2023

I self-certify!

@flowzone-app flowzone-app bot merged commit eefb0cf into main Sep 30, 2023
@flowzone-app flowzone-app bot deleted the use-effects-for-actions branch September 30, 2023 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant