Skip to main content

evaluate

Function evaluate 

Source
pub fn evaluate<'a, F, A>(fa: <F as Kind_cdc7cd43dac7585f>::Of<'a, A>) -> A
where F: Evaluable, A: 'a,
Expand description

Evaluates the effect, producing the inner value.

Free function version that dispatches to the type class’ associated function.

§Type Signature

forall f a. Evaluable f => f a -> a

§Type Parameters

  • 'a: The lifetime of the value.
  • F: The evaluable functor.
  • A: The type of the value inside the functor.

§Parameters

  • fa: The functor instance to evaluable.

§Returns

The inner value.

§Examples

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

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