pub trait WiltDispatch<'a, FnBrand, Brand: Kind_cdc7cd43dac7585f, M: Kind_cdc7cd43dac7585f, A: 'a, E: 'a, O: 'a, FA, Marker> {
// Required method
fn dispatch(
self,
ta: FA,
) -> <M as Kind_cdc7cd43dac7585f>::Of<'a, (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>)>;
}Expand description
Trait that routes a wilt operation to the appropriate type class method.
The Marker type parameter is an implementation detail resolved by
the compiler from the closure’s argument type; callers never specify
it directly. The FA type parameter is inferred from the container
argument: owned for Val dispatch, borrowed for Ref dispatch.
§Type Parameters
'a: The lifetime of the values.FnBrand: The brand of the cloneable function to use.Brand: The brand of the witherable structure.M: The applicative functor brand for the computation.A: The type of the elements in the input structure.E: The error type.O: The success type.FA: The container type (owned or borrowed), inferred from the argument.Marker: Dispatch marker type, inferred automatically. EitherValorRef.
Required Methods§
Sourcefn dispatch(
self,
ta: FA,
) -> <M as Kind_cdc7cd43dac7585f>::Of<'a, (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>)>
fn dispatch( self, ta: FA, ) -> <M as Kind_cdc7cd43dac7585f>::Of<'a, (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>)>
Perform the dispatched wilt operation.
§Type Signature
(self, FA) -> M (Brand E, Brand O)
§Parameters
self: The closure implementing this dispatch.ta: The structure to partition.
§Returns
The partitioned result in the applicative context.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
types::*,
};
let result = wilt::<RcFnBrand, OptionBrand, OptionBrand, _, _, _, _, _>(
|a: i32| Some(if a > 2 { Ok(a) } else { Err(a) }),
Some(5),
);
assert_eq!(result, Some((None, Some(5))));Implementors§
impl<'a, 'b, FnBrand, Brand, M, A, E, O, Func> WiltDispatch<'a, FnBrand, Brand, M, A, E, O, &'b <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, Ref> for Funcwhere
Brand: RefWitherable,
FnBrand: LiftFn + 'a,
A: 'a + Clone,
E: 'a + Clone,
O: 'a + Clone,
M: Applicative,
Func: Fn(&A) -> <M as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>> + 'a,
<Brand as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>: Clone,
<M as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>: Clone,
Routes Fn(&A) -> M::Of<Result<O, E>> closures to RefWitherable::ref_wilt.
The container must be passed by reference (&ta).
§Type Parameters
'a: The lifetime of the values.'b: The borrow lifetime.FnBrand: The cloneable function brand.Brand: The brand of the witherable structure.M: The applicative functor brand.A: The type of the elements in the input structure.E: The error type.O: The success type.Func: The closure type.
impl<'a, FnBrand, Brand, M, A, E, O, Func> WiltDispatch<'a, FnBrand, Brand, M, A, E, O, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>, Val> for Funcwhere
Brand: Witherable,
A: 'a + Clone,
E: 'a + Clone,
O: 'a + Clone,
M: Applicative,
Func: Fn(A) -> <M as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>> + 'a,
<Brand as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>: Clone,
<M as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>: Clone,
Routes Fn(A) -> M::Of<Result<O, E>> closures to Witherable::wilt.
§Type Parameters
'a: The lifetime of the values.FnBrand: The cloneable function brand (unused by Val path).Brand: The brand of the witherable structure.M: The applicative functor brand.A: The type of the elements in the input structure.E: The error type.O: The success type.Func: The closure type.