pub struct FnA;Expand description
Marker type whose P<A, B> is Box<dyn Fn(A) -> B>.
This is the canonical Arrow instance: the function arrow.
Equivalent to FnP in karpal-profunctor but independent (no cross-crate dep).
Trait Implementations§
Source§impl Arrow for FnA
impl Arrow for FnA
Source§fn arr<A, B>(f: impl Fn(A) -> B + 'static) -> Box<dyn Fn(A) -> B>
fn arr<A, B>(f: impl Fn(A) -> B + 'static) -> Box<dyn Fn(A) -> B>
Lift a pure function into an arrow.
Source§fn first<A, B, C>(pab: Box<dyn Fn(A) -> B>) -> Box<dyn Fn((A, C)) -> (B, C)>
fn first<A, B, C>(pab: Box<dyn Fn(A) -> B>) -> Box<dyn Fn((A, C)) -> (B, C)>
Apply an arrow to the first component of a pair, passing the second through.
Source§fn second<A, B, C>(pab: Box<dyn Fn(A) -> B>) -> Box<dyn Fn((C, A)) -> (C, B)>
fn second<A, B, C>(pab: Box<dyn Fn(A) -> B>) -> Box<dyn Fn((C, A)) -> (C, B)>
Apply an arrow to the second component of a pair.
Source§impl ArrowApply for FnA
impl ArrowApply for FnA
Source§impl ArrowChoice for FnA
impl ArrowChoice for FnA
Source§fn left<A, B, C>(
pab: Box<dyn Fn(A) -> B>,
) -> Box<dyn Fn(Result<A, C>) -> Result<B, C>>
fn left<A, B, C>( pab: Box<dyn Fn(A) -> B>, ) -> Box<dyn Fn(Result<A, C>) -> Result<B, C>>
Route the Ok branch through the arrow, passing Err through.
Source§fn right<A, B, C>(
pab: Box<dyn Fn(A) -> B>,
) -> Box<dyn Fn(Result<C, A>) -> Result<C, B>>
fn right<A, B, C>( pab: Box<dyn Fn(A) -> B>, ) -> Box<dyn Fn(Result<C, A>) -> Result<C, B>>
Route the Err branch through the arrow, passing Ok through.
Source§impl Braiding for FnA
Available on crate features alloc or std only.
impl Braiding for FnA
Available on crate features
alloc or std only.Source§impl Semigroupoid for FnA
impl Semigroupoid for FnA
Source§impl Tensor for FnA
Available on crate features alloc or std only.
impl Tensor for FnA
Available on crate features
alloc or std only.Source§fn tensor<A, B, C, D>(
left: <FnA as HKT2>::P<A, B>,
right: <FnA as HKT2>::P<C, D>,
) -> <FnA as HKT2>::P<(A, C), (B, D)>
fn tensor<A, B, C, D>( left: <FnA as HKT2>::P<A, B>, right: <FnA as HKT2>::P<C, D>, ) -> <FnA as HKT2>::P<(A, C), (B, D)>
Tensor two morphisms in parallel.
Source§fn associate<A, B, C>() -> Self::P<((A, B), C), (A, (B, C))>
fn associate<A, B, C>() -> Self::P<((A, B), C), (A, (B, C))>
The left-associated product
((a, b), c) -> (a, (b, c)).Source§fn associate_inv<A, B, C>() -> Self::P<(A, (B, C)), ((A, B), C)>
fn associate_inv<A, B, C>() -> Self::P<(A, (B, C)), ((A, B), C)>
The inverse associator
(a, (b, c)) -> ((a, b), c).Source§fn left_unitor_inv<A>() -> Self::P<A, ((), A)>where
A: Clone + 'static,
fn left_unitor_inv<A>() -> Self::P<A, ((), A)>where
A: Clone + 'static,
Inverse left unitor
a -> ((), a).Auto Trait Implementations§
impl Freeze for FnA
impl RefUnwindSafe for FnA
impl Send for FnA
impl Sync for FnA
impl Unpin for FnA
impl UnsafeUnpin for FnA
impl UnwindSafe for FnA
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
Mutably borrows from an owned value. Read more