pub struct Join<M, T, A>(_, _);
Expand description
Join is a newtype that provides a single fmap
implementation
for Bifunctor
s that have the same type for both parameters, e.g.
Result<A, A>
or (A, A)
.
use naan::prelude::*;
let r = Result::<(), ()>::Ok(()) // Result<(), ()>
.join()
.fmap(|_| format!("hello!")) // Result<String, String>
.unjoin();
assert_eq!(r, Ok(format!("hello!")));
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<M, T, A> RefUnwindSafe for Join<M, T, A>where A: RefUnwindSafe, M: RefUnwindSafe, T: RefUnwindSafe,
impl<M, T, A> Send for Join<M, T, A>where A: Send, M: Send, T: Send,
impl<M, T, A> Sync for Join<M, T, A>where A: Sync, M: Sync, T: Sync,
impl<M, T, A> Unpin for Join<M, T, A>where A: Unpin, M: Unpin, T: Unpin,
impl<M, T, A> UnwindSafe for Join<M, T, A>where A: UnwindSafe, M: UnwindSafe, T: UnwindSafe,
Blanket Implementations§
source§impl<F, A, TF, T> Sequence<F, A, TF> for T
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>,
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>,
See
Sequence