Struct naan::io::map::Map

source ·
pub struct Map<F, X, A, IOX>(_, _, _);
Expand description

A function from A to some B waiting to be applied to a lazy value, transforming it from IOLike<A> to IOLike<B>.

This is the result of calling [FunctorSurrogate.map_] on an IOLike.

Implementations§

source§

impl<F, X, A, IOA> Map<F, X, A, IOA>

source

pub fn new(f: F, ioa: IOA) -> Self

Create a new Map

Trait Implementations§

source§

impl<F, X, A, IOX> Clone for Map<F, X, A, IOX>where F: Clone, IOX: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F, X, A, IOX> Debug for Map<F, X, A, IOX>where F: Debug, IOX: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F, X, A, IOX> Equiv for Map<F, X, A, IOX>where F: F1Once<X>, IOX: Equiv<To = IO<X>>,

§

type To = IO<<F as F1Once<X>>::Ret>

Map<F, A, IOA> is conceptually equivalent to IO<{return type of F}>

source§

impl<F, X, A, IOX> IOLike<<F as F1Once<X>>::Ret> for Map<F, X, A, IOX>where F: F1Once<X, Ret = A>, IOX: IOLike<X>,

source§

fn exec(self) -> F::Ret

Execute this lazy computation
source§

impl<F, X, A, IOA> Copy for Map<F, X, A, IOA>where F: Copy, IOA: Copy,

Auto Trait Implementations§

§

impl<F, X, A, IOX> RefUnwindSafe for Map<F, X, A, IOX>where A: RefUnwindSafe, F: RefUnwindSafe, IOX: RefUnwindSafe, X: RefUnwindSafe,

§

impl<F, X, A, IOX> Send for Map<F, X, A, IOX>where A: Send, F: Send, IOX: Send, X: Send,

§

impl<F, X, A, IOX> Sync for Map<F, X, A, IOX>where A: Sync, F: Sync, IOX: Sync, X: Sync,

§

impl<F, X, A, IOX> Unpin for Map<F, X, A, IOX>where A: Unpin, F: Unpin, IOX: Unpin, X: Unpin,

§

impl<F, X, A, IOX> UnwindSafe for Map<F, X, A, IOX>where A: UnwindSafe, F: UnwindSafe, IOX: UnwindSafe, X: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<I, A> ApplicativeSurrogate<IO, A> for Iwhere I: Equiv<To = IO<A>> + IOLike<A>,

source§

fn pure(a: A) -> IO<A>

Lift A to F<A>
source§

impl<I, AB, TofA> ApplySurrogate<IO, AB, TofA> for Iwhere I: Equiv<To = IO<AB>> + IOLike<AB>,

§

type ApplyOutput = Apply<A, B, AB, TofA, I>

Type returned by apply_ that is conceptually the same as F::T<B>. Read more
source§

fn apply_<A, B>(self, a: TofA) -> Apply<A, B, AB, TofA, I>where AB: F1Once<A, Ret = B>,

Apply the function A -> B contained in Self (F<A -> B>) to an instance of F<A> to get F<B>.
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<I, A> FunctorSurrogate<IO, A> for Iwhere I: Equiv<To = IO<A>> + IOLike<A>,

§

type Output = Map<AB, A, B, I>

Type yielded by fmap that is akin to F::T<B>. Read more
source§

fn map_<AB, B>(self, f: AB) -> Map<AB, A, B, I>where AB: F1<A, Ret = B>,

Use a function from A -> B to transform something akin to F<A> to something akin to F<B>.
source§

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

const: unstable · 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<I, A> MonadSurrogate<IO, A> for Iwhere I: Equiv<To = IO<A>> + IOLike<A>,

§

type BindOutput = Bind<AMB, A, B, I>

Type yielded by bind_ that isn’t exactly M::T<B>, but is conceptually Equivalent. Read more
source§

fn bind_<B, AMB>( self, f: AMB ) -> <I as MonadSurrogate<IO, A>>::BindOutput<B, AMB>where AMB: F1<A, Ret = <IO as HKT1>::T<B>>,

Use a function from A -> M<B> to transform something akin to M<A> to something akin to M<B>.
source§

impl<F, A, TF, T> Sequence<F, A, TF> for T

source§

fn sequence<Ap>(self) -> Ap::T<F::T<A>>where Self: Sized + Traversable<F, Ap::T<A>, A, TF> + Foldable<F, Ap::T<A>>, Ap: HKT1, Ap::T<A>: Applicative<Ap, A> + ApplyOnce<Ap, A>, Ap::T<TF>: Applicative<Ap, TF> + ApplyOnce<Ap, TF>, Ap::T<F::T<A>>: Applicative<Ap, F::T<A>> + ApplyOnce<Ap, F::T<A>>, F: HKT1<T<Ap::T<A>> = Self>,

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.