Skip to main content

Runnable

Trait Runnable 

Source
pub trait Runnable: Functor {
    // Required method
    fn run<'a, A: 'a>(fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A;
}
Expand description

A functor whose effects can be “run” to produce the inner value.

This trait is used by Free::run to execute the effects in a Free monad.

Required Methods§

Source

fn run<'a, A: 'a>(fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A

Runs the effect, producing the inner value.

§Type Signature

forall a. Runnable f => f a -> a

§Type Parameters
  • A: The type of the value inside the functor.
§Parameters
  • fa: The functor instance to run.
§Returns

The inner value.

§Examples
use fp_library::{brands::*, functions::*, types::*};

let eval = Thunk::new(|| 42);
assert_eq!(runnable_run::<ThunkBrand, _>(eval), 42);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§