rosefromthedead / effing-mad Goto Github PK
View Code? Open in Web Editor NEWAlgebraic effects for Rust
Algebraic effects for Rust
#![feature(coroutines)]
#![feature(coroutine_trait)]
use std::borrow::Cow;
use effing_mad::{effectful, handle_group, handler};
use steamctl::cli_options::{options, Options};
effing_mad::effects! {
Console<'a> {
fn print(s: Cow<'a, str>) -> ();
}
}
effing_mad::effects! {
CliOptions {
fn read() -> Options;
}
}
fn main() {
let console_handler = handler!(Console {
print(s, _) => println!("{s}"),
});
let with_console = handle_group(do_command(), console_handler);
let cli_options_handler = handler!(CliOptions {
read() => options().run(),
});
let with_cli_options = handle_group(with_console, cli_options_handler);
effing_mad::run(with_cli_options);
}
#[effectful(CliOptions, Console<'a>)]
fn do_command<'a>() {
let options = yield CliOptions::read();
yield Console::print(format!("{options:?}").into());
}
cargo clippy -- --verbose &> clippy.log
:
Checking steamctl v0.1.0 (/home/teohhanhui/Projects/teohhanhui/steamctl-rs)
error[E0277]: the trait bound `Console<'a>: effing_mad::Effect` is not satisfied
--> src/bin/steamctl.rs:34:1
|
34 | #[effectful(CliOptions, Console<'a>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `effing_mad::Effect` is not implemented for `Console<'a>`, which is required by `effing_mad::frunk::Coproduct<Console<'a>, effing_mad::frunk::coproduct::CNil>: effing_mad::injection::EffectList`
|
= help: the following other types implement trait `effing_mad::Effect`:
print<'a>
effing_mad::effects::future::Await
effing_mad::effects::future::GetContext
read
= note: required for `effing_mad::frunk::Coproduct<Console<'a>, effing_mad::frunk::coproduct::CNil>` to implement `effing_mad::injection::EffectList`
error[E0277]: the trait bound `effing_mad::frunk::coproduct::CNil: effing_mad::frunk::coproduct::CoprodUninjector<effing_mad::injection::Tagged<(), print<'_>>, _>` is not satisfied
--> src/bin/steamctl.rs:34:1
|
34 | #[effectful(CliOptions, Console<'a>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `effing_mad::frunk::coproduct::CoprodUninjector<effing_mad::injection::Tagged<(), print<'_>>, _>` is not implemented for `effing_mad::frunk::coproduct::CNil`, which is required by `effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>: effing_mad::frunk::coproduct::CoprodUninjector<effing_mad::injection::Tagged<(), print<'_>>, _>`
|
= help: the following other types implement trait `effing_mad::frunk::coproduct::CoprodUninjector<T, Idx>`:
<effing_mad::frunk::Coproduct<Hd, Tl> as effing_mad::frunk::coproduct::CoprodUninjector<Hd, effing_mad::frunk::indices::Here>>
<effing_mad::frunk::Coproduct<Hd, Tl> as effing_mad::frunk::coproduct::CoprodUninjector<T, effing_mad::frunk::indices::There<N>>>
= note: required for `effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>` to implement `effing_mad::frunk::coproduct::CoprodUninjector<effing_mad::injection::Tagged<(), print<'_>>, effing_mad::frunk::indices::There<_>>`
= note: 2 redundant requirements hidden
= note: required for `effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>` to implement `effing_mad::frunk::coproduct::CoprodUninjector<effing_mad::injection::Tagged<(), print<'_>>, effing_mad::frunk::indices::There<effing_mad::frunk::indices::There<effing_mad::frunk::indices::There<_>>>>`
note: required by a bound in `effing_mad::macro_impl::get_inj`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/macro_impl.rs:30:11
|
27 | pub fn get_inj<E, Injs, Index>(injs: Injs, _marker: PhantomData<E>) -> Option<E::Injection>
| ------- required by a bound in this function
...
30 | Injs: CoprodUninjector<Tagged<E::Injection, E>, Index>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get_inj`
= note: this error originates in the attribute macro `effectful` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `effing_mad::frunk::coproduct::CNil: effing_mad::frunk::coproduct::CoprodInjector<print<'_>, _>` is not satisfied
--> src/bin/steamctl.rs:34:1
|
34 | #[effectful(CliOptions, Console<'a>)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `effing_mad::frunk::coproduct::CoprodInjector<print<'_>, _>` is not implemented for `effing_mad::frunk::coproduct::CNil`, which is required by `effing_mad::frunk::Coproduct<read, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>>: effing_mad::frunk::coproduct::CoprodInjector<print<'_>, _>`
|
= help: the following other types implement trait `effing_mad::frunk::coproduct::CoprodInjector<InjectType, Index>`:
<effing_mad::frunk::Coproduct<Head, Tail> as effing_mad::frunk::coproduct::CoprodInjector<I, effing_mad::frunk::indices::There<TailIndex>>>
<effing_mad::frunk::Coproduct<I, Tail> as effing_mad::frunk::coproduct::CoprodInjector<I, effing_mad::frunk::indices::Here>>
= note: required for `effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>` to implement `effing_mad::frunk::coproduct::CoprodInjector<print<'_>, effing_mad::frunk::indices::There<_>>`
= note: 1 redundant requirement hidden
= note: required for `effing_mad::frunk::Coproduct<read, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>>` to implement `effing_mad::frunk::coproduct::CoprodInjector<print<'_>, effing_mad::frunk::indices::There<effing_mad::frunk::indices::There<_>>>`
note: required by a bound in `effing_mad::frunk::Coproduct::<Head, Tail>::inject`
--> /home/teohhanhui/.cargo/registry/src/index.crates.io-6f17d22bba15001f/frunk_core-0.4.2/src/coproduct.rs:166:15
|
164 | pub fn inject<T, Index>(to_insert: T) -> Self
| ------ required by a bound in this associated function
165 | where
166 | Self: CoprodInjector<T, Index>,
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Coproduct::<Head, Tail>::inject`
= note: this error originates in the attribute macro `effectful` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Console<'_>: effing_mad::Effect` is not satisfied
--> src/bin/steamctl.rs:25:37
|
25 | let with_console = handle_group(do_command(), console_handler);
| ------------ ^^^^^^^^^^^^ the trait `effing_mad::Effect` is not implemented for `Console<'_>`, which is required by `effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>: effing_mad::injection::EffectList`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `effing_mad::Effect`:
print<'a>
effing_mad::effects::future::Await
effing_mad::effects::future::GetContext
read
= note: required for `effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>` to implement `effing_mad::injection::EffectList`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:208:8
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
208 | G: Coroutine<PreIs, Yield = PreEs, Return = R>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0277]: the trait bound `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield: effing_mad::injection::EffectList` is not satisfied
--> src/bin/steamctl.rs:25:24
|
25 | let with_console = handle_group(do_command(), console_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `effing_mad::injection::EffectList` is not implemented for `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield`
|
= help: the following other types implement trait `effing_mad::injection::EffectList`:
effing_mad::frunk::Coproduct<E, Es>
effing_mad::frunk::coproduct::CNil
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:204:12
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
204 | PreEs: EffectList<Injections = PreIs> + CoproductSubsetter<Es, EffsIndices, Remainder = PostEs>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:25:51
|
22 | let console_handler = handler!(Console {
| ___________________________-
23 | | print(s, _) => println!("{s}"),
24 | | });
| |______- found signature defined here
25 | let with_console = handle_group(do_command(), console_handler);
| ------------ ^^^^^^^^^^^^^^^ expected due to this
| |
| required by a bound introduced by this call
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
help: consider wrapping the function in a closure
|
25 | let with_console = handle_group(do_command(), |arg0: effing_mad::frunk::coproduct::CNil| console_handler(/* effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil> */));
| ++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:25:24
|
22 | let console_handler = handler!(Console {
| ___________________________-
23 | | print(s, _) => println!("{s}"),
24 | | });
| |______- found signature defined here
25 | let with_console = handle_group(do_command(), console_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0277]: the trait bound `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield: effing_mad::injection::EffectList` is not satisfied
--> src/bin/steamctl.rs:29:28
|
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^ the trait `effing_mad::injection::EffectList` is not implemented for `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield`
|
= help: the following other types implement trait `effing_mad::injection::EffectList`:
effing_mad::frunk::Coproduct<E, Es>
effing_mad::frunk::coproduct::CNil
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:204:12
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
204 | PreEs: EffectList<Injections = PreIs> + CoproductSubsetter<Es, EffsIndices, Remainder = PostEs>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0277]: the trait bound `Console<'_>: effing_mad::Effect` is not satisfied
--> src/bin/steamctl.rs:29:28
|
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^ the trait `effing_mad::Effect` is not implemented for `Console<'_>`, which is required by `effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>: effing_mad::injection::EffectList`
|
= help: the following other types implement trait `effing_mad::Effect`:
print<'a>
effing_mad::effects::future::Await
effing_mad::effects::future::GetContext
read
= note: required for `effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>` to implement `effing_mad::injection::EffectList`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:208:8
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
208 | G: Coroutine<PreIs, Yield = PreEs, Return = R>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:29:28
|
22 | let console_handler = handler!(Console {
| ___________________________-
23 | | print(s, _) => println!("{s}"),
24 | | });
| |______- found signature defined here
...
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0277]: the trait bound `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield: effing_mad::injection::EffectList` is not satisfied
--> src/bin/steamctl.rs:29:28
|
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `effing_mad::injection::EffectList` is not implemented for `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield`
|
= help: the following other types implement trait `effing_mad::injection::EffectList`:
effing_mad::frunk::Coproduct<E, Es>
effing_mad::frunk::coproduct::CNil
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:204:12
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
204 | PreEs: EffectList<Injections = PreIs> + CoproductSubsetter<Es, EffsIndices, Remainder = PostEs>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:29:55
|
26 | let cli_options_handler = handler!(CliOptions {
| _______________________________-
27 | | read() => options().run(),
28 | | });
| |______- found signature defined here
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ------------ ^^^^^^^^^^^^^^^^^^^ expected due to this
| |
| required by a bound introduced by this call
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<read, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
help: consider wrapping the function in a closure
|
29 | let with_cli_options = handle_group(with_console, |arg0: effing_mad::frunk::coproduct::CNil| cli_options_handler(/* effing_mad::frunk::Coproduct<read, effing_mad::frunk::coproduct::CNil> */));
| ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:29:28
|
26 | let cli_options_handler = handler!(CliOptions {
| _______________________________-
27 | | read() => options().run(),
28 | | });
| |______- found signature defined here
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<read, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:29:28
|
22 | let console_handler = handler!(Console {
| ___________________________-
23 | | print(s, _) => println!("{s}"),
24 | | });
| |______- found signature defined here
...
29 | let with_cli_options = handle_group(with_console, cli_options_handler);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0271]: type mismatch resolving `<impl Coroutine<Coproduct<Begin, CNil>, Yield = <impl Coroutine<<<Coproduct<CliOptions, Coproduct<..., ...>> as FlattenEffects>::Out as EffectList>::Injections, Yield = ..., Return = ...> as Coroutine<...>>::Yield> as Coroutine<...>>::Yield == CNil`
--> src/bin/steamctl.rs:31:21
|
31 | effing_mad::run(with_cli_options);
| --------------- ^^^^^^^^^^^^^^^^ expected `CNil`, found associated type
| |
| required by a bound introduced by this call
...
34 | #[effectful(CliOptions, Console<'a>)]
| ------------------------------------- the found opaque type
|
= note: expected enum `effing_mad::frunk::coproduct::CNil`
found associated type `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield`
note: required by a bound in `effing_mad::run`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:77:42
|
75 | pub fn run<F, R>(mut f: F) -> R
| --- required by a bound in this function
76 | where
77 | F: Coroutine<Coproduct<Begin, CNil>, Yield = CNil, Return = R>,
| ^^^^^^^^^^^^ required by this bound in `run`
help: consider constraining the associated type `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield` to `effing_mad::frunk::coproduct::CNil`
|
34 | #[effectful(CliOptions, Console<'a>)]<Yield = effing_mad::frunk::coproduct::CNil>
| ++++++++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield: effing_mad::injection::EffectList` is not satisfied
--> src/bin/steamctl.rs:31:5
|
31 | effing_mad::run(with_cli_options);
| ^^^^^^^^^^^^^^^ the trait `effing_mad::injection::EffectList` is not implemented for `<impl std::ops::Coroutine<<<effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out as effing_mad::injection::EffectList>::Injections, Yield = <effing_mad::frunk::Coproduct<CliOptions, effing_mad::frunk::Coproduct<Console<'_>, effing_mad::frunk::coproduct::CNil>> as effing_mad::macro_impl::FlattenEffects>::Out, Return = ()> as std::ops::Coroutine<effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<steamctl::cli_options::Options, read>, effing_mad::frunk::Coproduct<effing_mad::injection::Tagged<_, Console<'_>>, effing_mad::frunk::Coproduct<effing_mad::injection::Begin, effing_mad::frunk::coproduct::CNil>>>>>::Yield`
|
= help: the following other types implement trait `effing_mad::injection::EffectList`:
effing_mad::frunk::Coproduct<E, Es>
effing_mad::frunk::coproduct::CNil
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:204:12
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
204 | PreEs: EffectList<Injections = PreIs> + CoproductSubsetter<Es, EffsIndices, Remainder = PostEs>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:31:5
|
26 | let cli_options_handler = handler!(CliOptions {
| _______________________________-
27 | | read() => options().run(),
28 | | });
| |______- found signature defined here
...
31 | effing_mad::run(with_cli_options);
| ^^^^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<read, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
error[E0631]: type mismatch in closure arguments
--> src/bin/steamctl.rs:31:5
|
22 | let console_handler = handler!(Console {
| ___________________________-
23 | | print(s, _) => println!("{s}"),
24 | | });
| |______- found signature defined here
...
31 | effing_mad::run(with_cli_options);
| ^^^^^^^^^^^^^^^ expected due to this
|
= note: expected closure signature `fn(effing_mad::frunk::coproduct::CNil) -> _`
found closure signature `fn(effing_mad::frunk::Coproduct<print<'_>, effing_mad::frunk::coproduct::CNil>) -> _`
note: required by a bound in `effing_mad::handle_group`
--> /home/teohhanhui/.cargo/git/checkouts/effing-mad-e103e8f2d0b7efef/770c85e/src/lib.rs:199:36
|
184 | pub fn handle_group<
| ------------ required by a bound in this function
...
199 | mut handler: impl FnMut(Es) -> ControlFlow<R, Is>,
| ^^^^^^^^^^^^^^^^^^ required by this bound in `handle_group`
Some errors have detailed explanations: E0271, E0277, E0631.
For more information about an error, try `rustc --explain E0271`.
error: could not compile `steamctl` (bin "steamctl") due to 18 previous errors
Using 1 EffectGroup
+ 1 Effect
works though...
I think those libraries need to be added to dev-dependencies or the example needs to have less dependencies.
Currently:
fn main() {
let console_handler = handler!(Console {
print(s, _) => println!("{s}"),
});
let with_console = handle_group(do_command(), console_handler);
let cli_options_handler = handler!(CliOptions {
read() => options().run(),
});
let with_cli_options = handle_group(with_console, cli_options_handler);
effing_mad::run(with_cli_options);
}
What if:
fn main() {
let console_handler = handler!(Console {
print(s, _) => println!("{s}"),
});
let cli_options_handler = handler!(CliOptions {
read() => options().run(),
});
effing_mad::run!(
do_command()
|> handle_group(console_handler)
|> handle_group(cli_options_handler)
);
}
And mainly because naming is hard... There is nothing special about with_cli_options
in the previous code other than it just happens to be the last in the chain?
it made me laugh out loud innerly
great work
love it
<3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.