algoroutine
Light-weight algebraic effect (algebraic goroutine) in Rust.
Using go!
macro just as Haskell's do notation while we use algebraic effects
instead of monads to avoid monad's composition issue.
Only zero-shot algebraic effect based on coroutine is supported.
Therefore we need nightly compiler to transform code.
Main macros and combinators
go!
macro to run effects and coroutines, just like?
and.await
.Coroutine.map
to map results.Coroutine.and_then
to chain operations.
Example
let logic = |_: | ;
// Now we can use different ways to interpret `Log` and `State` effects!
let mut handler: = new;
let ans = handler.handle;
dbg!;
See examples/logging_and_states for details.
Fun facts
goroutine
is coolalgebraic effect
is coolalgebraic goroutine (algoroutine)
is probably bad ;)