Skip to main content

Day

Struct Day 

Source
pub struct Day<F, G, A, B, C>
where F: HKT, G: HKT,
{ /* private fields */ }
Expand description

Day Convolution — combines two functors F and G into a single computation.

Day<F, G, A, B, C> ≅ (F B, G C, B → C → A)

Stores an F value, a G value, and a combining function. The intermediate types B and C are visible in the type signature (Rust lacks first-class existential types, same as Lan and Coyoneda).

§Key properties

  • Functor in A: fmap composes onto the combining function, no bounds on F or G needed.
  • Interpretation: run_day uses two natural transformations (one for F, one for G) to interpret into a target Applicative.

Implementations§

Source§

impl<F, G, A, B, C> Day<F, G, A, B, C>
where F: HKT + 'static, G: HKT + 'static, A: 'static, B: Clone + 'static, C: Clone + 'static,

Source

pub fn new( f_val: <F as HKT>::Of<B>, g_val: <G as HKT>::Of<C>, combine: impl Fn(B, C) -> A + 'static, ) -> Day<F, G, A, B, C>

Construct a Day from two functor values and a combining function.

Source

pub fn fmap<D>(self, f: impl Fn(A) -> D + 'static) -> Day<F, G, D, B, C>
where D: 'static,

Map a function over the result. No bounds on F or G required.

Source

pub fn run_day<M, NF, NG>(self) -> <M as HKT>::Of<A>

Interpret this Day value into a target applicative M using two natural transformations: NF: F ~> M and NG: G ~> M.

Auto Trait Implementations§

§

impl<F, G, A, B, C> !RefUnwindSafe for Day<F, G, A, B, C>

§

impl<F, G, A, B, C> !Send for Day<F, G, A, B, C>

§

impl<F, G, A, B, C> !Sync for Day<F, G, A, B, C>

§

impl<F, G, A, B, C> !UnwindSafe for Day<F, G, A, B, C>

§

impl<F, G, A, B, C> Freeze for Day<F, G, A, B, C>
where <F as HKT>::Of<B>: Freeze, <G as HKT>::Of<C>: Freeze,

§

impl<F, G, A, B, C> Unpin for Day<F, G, A, B, C>
where <F as HKT>::Of<B>: Unpin, <G as HKT>::Of<C>: Unpin, F: Unpin, G: Unpin,

§

impl<F, G, A, B, C> UnsafeUnpin for Day<F, G, A, B, C>
where <F as HKT>::Of<B>: UnsafeUnpin, <G as HKT>::Of<C>: UnsafeUnpin,

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.