pub struct Map<'a, Op, D> { /* private fields */ }
Expand description
A representation of an arbitrary Functor
mapping.
This struct is what facilitates lazy evaluation of Functor
mappings,
allowing them to be chained together and evaluated in a single pass.
Where a Functor
defines the semantics of a mapping over a type, Map
represents an instance of a mapping over that type. In other words, Map
is simply a pairing of a Functor
with the Operation
that will be
mapped over it.
A subtle implementation detail is that we do not actually embed a
Functor
, but rather a Directive
that outputs a Functor
. This is
what allows us to chain Directive
s together, as the output of one
Directive
is the input to the next.
Trait Implementations§
Source§impl<'a, Op: Operation, F: Functor<'a, Op::Output, A = Op::Input> + Send, D: Directive<Output = F> + Send> Directive for Map<'a, Op, D>
impl<'a, Op: Operation, F: Functor<'a, Op::Output, A = Op::Input> + Send, D: Directive<Output = F> + Send> Directive for Map<'a, Op, D>
The implementation drives the evaluation of the input Directive
,
returning the input Functor
, and then mapping the given Operation
over it.