Trait naan::functor::FunctorSurrogate
source · pub trait FunctorSurrogate<F, A>where
F: HKT1,
Self: Equiv<To = F::T<A>>,{
type Output<AB, B>;
// Required method
fn map_<AB, B>(self, f: AB) -> Self::Output<AB, B>
where AB: F1<A, Ret = B>,
Self::Output<AB, B>: Equiv<To = F::T<B>>;
}
Expand description
Required Associated Types§
sourcetype Output<AB, B>
type Output<AB, B>
Type yielded by fmap
that is akin to F::T<B>
.
The output type may use both type parameters, or only one.
The reason we allow the output to be parameterized by AB
(the function from A -> B
)
is so that the returning type can store the function and defer transformation.
This allows implementing lazy functors with no heap dependency (ex. IO
)