Skip to main content

EitherKleisli

Struct EitherKleisli 

Source
pub struct EitherKleisli<E, A, B> {
    pub run: Box<dyn Fn(A) -> OxiEither<B, E>>,
}
Expand description

A Kleisli arrow A → Either E B in the Either monad’s Kleisli category.

Fields§

§run: Box<dyn Fn(A) -> OxiEither<B, E>>

The underlying function from A to OxiEither<B, E>.

Implementations§

Source§

impl<E: 'static, A: 'static, B: 'static> EitherKleisli<E, A, B>

Source

pub fn new<F: Fn(A) -> OxiEither<B, E> + 'static>(f: F) -> Self

Construct a new Kleisli arrow from a function.

Source

pub fn apply(&self, a: A) -> OxiEither<B, E>

Apply the Kleisli arrow to an input.

Source

pub fn compose<C: 'static>( self, g: EitherKleisli<E, B, C>, ) -> EitherKleisli<E, A, C>
where E: Clone + 'static,

Compose two Kleisli arrows: (f >=> g)

Source

pub fn lift_fn<F: Fn(A) -> B + 'static>(f: F) -> Self

Lift a plain function into the Kleisli category (i.e., return ∘ f).

Auto Trait Implementations§

§

impl<E, A, B> Freeze for EitherKleisli<E, A, B>

§

impl<E, A, B> !RefUnwindSafe for EitherKleisli<E, A, B>

§

impl<E, A, B> !Send for EitherKleisli<E, A, B>

§

impl<E, A, B> !Sync for EitherKleisli<E, A, B>

§

impl<E, A, B> Unpin for EitherKleisli<E, A, B>

§

impl<E, A, B> UnsafeUnpin for EitherKleisli<E, A, B>

§

impl<E, A, B> !UnwindSafe for EitherKleisli<E, A, B>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.