Skip to main content

extract

Function extract 

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

Extracts the inner value.

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

§Type Signature

forall F A. Extract F => F A -> A

§Type Parameters

  • 'a: The lifetime of the value.
  • F: The extractable type.
  • A: The type of the value inside the container.

§Parameters

  • fa: The container to extract from.

§Returns

The inner value.

§Examples

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

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