Skip to main content

ContAdj

Struct ContAdj 

Source
pub struct ContAdj<R>(/* private fields */);
Expand description

Witness for the self-adjunction ContF<R> ⊣ ContF<R>.

This is the canonical contravariant adjunction. The composed functor ContF<R> . ContF<R> gives Of<A> = (A -> R) -> R, the continuation monad.

  • unit(a) = |k| k(a) (embed a value into CPS)
  • counit(b) = |k| k(b) (same operation — self-adjoint!)

Trait Implementations§

Source§

impl<R> ContravariantAdjunction<ContF<R>, ContF<R>> for ContAdj<R>
where R: 'static,

Available on crate features alloc or std only.
Source§

fn unit<A>(a: A) -> Box<dyn Fn(Box<dyn Fn(A) -> R>) -> R>
where A: Clone + 'static,

unit: A -> G(F(A)) Read more
Source§

fn counit<B>(b: B) -> Box<dyn Fn(Box<dyn Fn(B) -> R>) -> R>
where B: Clone + 'static,

counit: B -> F(G(B)) Read more

Auto Trait Implementations§

§

impl<R> Freeze for ContAdj<R>

§

impl<R> RefUnwindSafe for ContAdj<R>
where R: RefUnwindSafe,

§

impl<R> Send for ContAdj<R>
where R: Send,

§

impl<R> Sync for ContAdj<R>
where R: Sync,

§

impl<R> Unpin for ContAdj<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for ContAdj<R>

§

impl<R> UnwindSafe for ContAdj<R>
where R: UnwindSafe,

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.