pub trait Evaluable: Functor {
// Required method
fn evaluate<'a, A: 'a>(fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A;
}Expand description
A functor whose effects can be evaluated to produce the inner value.
This trait is used by Free::evaluate to execute the effects
in a Free monad.
Required Methods§
Sourcefn evaluate<'a, A: 'a>(fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A
fn evaluate<'a, A: 'a>(fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A
Evaluates the effect, producing the inner value.
§Type Signature
forall self a. Evaluable self => self a -> a
§Type Parameters
'a: The lifetime of the value.A: The type of the value inside the functor.
§Parameters
fa: The functor instance to evaluate.
§Returns
The inner value.
§Examples
use fp_library::{brands::*, functions::*, types::*};
let eval = Thunk::new(|| 42);
assert_eq!(evaluate::<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.