pub struct BifunctorFirstAppliedBrand<Brand, A>(/* private fields */);Expand description
An adapter that partially applies a Bifunctor to its first argument, creating a Functor over the second argument.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let x = Result::<i32, i32>::Ok(5);
let y = map::<BifunctorFirstAppliedBrand<ResultBrand, i32>, _, _, _, _>(|s| s * 2, x);
assert_eq!(y, Ok(10));Trait Implementations§
Source§impl<Brand: Clone, A: Clone> Clone for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand: Clone, A: Clone> Clone for BifunctorFirstAppliedBrand<Brand, A>
Source§fn clone(&self) -> BifunctorFirstAppliedBrand<Brand, A>
fn clone(&self) -> BifunctorFirstAppliedBrand<Brand, A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Brand: Bifunctor, A: 'static> Functor for BifunctorFirstAppliedBrand<Brand, A>
Functor instance for BifunctorFirstAppliedBrand.
impl<Brand: Bifunctor, A: 'static> Functor for BifunctorFirstAppliedBrand<Brand, A>
Functor instance for BifunctorFirstAppliedBrand.
Maps over the first type parameter of a bifunctor by delegating to Bifunctor::bimap
with identity for the second argument.
§Type Parameters
Brand: The bifunctor brand.A: The fixed second type parameter.
Source§fn map<'a, B: 'a, C: 'a>(
f: impl Fn(B) -> C + 'a,
fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
fn map<'a, B: 'a, C: 'a>( f: impl Fn(B) -> C + 'a, fa: <Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
Map a function over the first type parameter.
§Type Signature
forall Brand A B C. Bifunctor Brand => (B -> C, BifunctorFirstApplied Brand A B) -> BifunctorFirstApplied Brand A C
§Type Parameters
'a: The lifetime of the values.B: The input type.C: The output type.
§Parameters
f: The function to apply.fa: The bifunctor value to map over.
§Returns
The mapped bifunctor value.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let x = Result::<i32, i32>::Ok(5);
let y = map::<BifunctorFirstAppliedBrand<ResultBrand, i32>, _, _, _, _>(|s| s * 2, x);
assert_eq!(y, Ok(10));Source§impl<Brand: Bifunctor, A: 'static> Kind_cdc7cd43dac7585f for BifunctorFirstAppliedBrand<Brand, A>
Generated implementation of Kind_cdc7cd43dac7585f for BifunctorFirstAppliedBrand < Brand, A >.
impl<Brand: Bifunctor, A: 'static> Kind_cdc7cd43dac7585f for BifunctorFirstAppliedBrand<Brand, A>
Generated implementation of Kind_cdc7cd43dac7585f for BifunctorFirstAppliedBrand < Brand, A >.
Source§type Of<'a, B: 'a> = <Brand as Kind_266801a817966495>::Of<'a, A, B>
type Of<'a, B: 'a> = <Brand as Kind_266801a817966495>::Of<'a, A, B>
Source§impl<Brand: Ord, A: Ord> Ord for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand: Ord, A: Ord> Ord for BifunctorFirstAppliedBrand<Brand, A>
Source§fn cmp(&self, other: &BifunctorFirstAppliedBrand<Brand, A>) -> Ordering
fn cmp(&self, other: &BifunctorFirstAppliedBrand<Brand, A>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<Brand: PartialEq, A: PartialEq> PartialEq for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand: PartialEq, A: PartialEq> PartialEq for BifunctorFirstAppliedBrand<Brand, A>
Source§fn eq(&self, other: &BifunctorFirstAppliedBrand<Brand, A>) -> bool
fn eq(&self, other: &BifunctorFirstAppliedBrand<Brand, A>) -> bool
self and other values to be equal, and is used by ==.Source§impl<Brand: PartialOrd, A: PartialOrd> PartialOrd for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand: PartialOrd, A: PartialOrd> PartialOrd for BifunctorFirstAppliedBrand<Brand, A>
Source§impl<Brand: Bifunctor + RefBifunctor, A: Clone + 'static> RefFunctor for BifunctorFirstAppliedBrand<Brand, A>
RefFunctor instance for BifunctorFirstAppliedBrand.
impl<Brand: Bifunctor + RefBifunctor, A: Clone + 'static> RefFunctor for BifunctorFirstAppliedBrand<Brand, A>
RefFunctor instance for BifunctorFirstAppliedBrand.
Maps over the first type parameter of a bifunctor by reference, delegating to
RefBifunctor::ref_bimap with Clone::clone for the second argument.
Requires Clone on the fixed second type parameter because the value must be
cloned out of the borrowed container.
§Type Parameters
Brand: The bifunctor brand.A: The fixed second type parameter.
Source§fn ref_map<'a, B: 'a, C: 'a>(
func: impl Fn(&B) -> C + 'a,
fa: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
fn ref_map<'a, B: 'a, C: 'a>( func: impl Fn(&B) -> C + 'a, fa: &<Self as Kind_cdc7cd43dac7585f>::Of<'a, B>, ) -> <Self as Kind_cdc7cd43dac7585f>::Of<'a, C>
Maps a function over the first type parameter by reference.
§Type Signature
forall Brand A B C. (Bifunctor Brand, RefBifunctor Brand) => (&B -> C, &BifunctorFirstApplied Brand A B) -> BifunctorFirstApplied Brand A C
§Type Parameters
'a: The lifetime of the values.B: The input type.C: The output type.
§Parameters
func: The function to apply.fa: The bifunctor value to map over.
§Returns
The mapped bifunctor value.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let x = Result::<i32, i32>::Ok(5);
let y = map::<BifunctorFirstAppliedBrand<ResultBrand, i32>, _, _, _, _>(|s: &i32| *s * 2, &x);
assert_eq!(y, Ok(10));impl<Brand: Copy, A: Copy> Copy for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand: Eq, A: Eq> Eq for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> StructuralPartialEq for BifunctorFirstAppliedBrand<Brand, A>
Auto Trait Implementations§
impl<Brand, A> Freeze for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> RefUnwindSafe for BifunctorFirstAppliedBrand<Brand, A>where
Brand: RefUnwindSafe,
A: RefUnwindSafe,
impl<Brand, A> Send for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> Sync for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> Unpin for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> UnsafeUnpin for BifunctorFirstAppliedBrand<Brand, A>
impl<Brand, A> UnwindSafe for BifunctorFirstAppliedBrand<Brand, A>where
Brand: UnwindSafe,
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more