Enum operational::Program
[−]
[src]
pub enum Program<'a, I: Instr, A> { Pure(Box<A>), Then(Box<I>, Kleisli<'a, I, I::Return, A>), }
Represents a program, i.e. a sequence of instructions.
- The instructions are given by the type
I
. A
is the return type of the program.
Variants
Pure | The case |
Then | The case |
Methods
impl<'a, I: 'a + Instr, A> Program<'a, I, A>
fn and_then<B, F>(self, js: F) -> Program<'a, I, B> where F: 'a + Fn(A) -> Program<'a, I, B>
Appends a continuation to a program. Which means,
given a function from A
to Program<I, B>
,
passes the return value of the program to the function,
and returns the resulting program.
Equivalent to the monadic >>=
operator.
fn map<B, F>(self, f: F) -> Program<'a, I, B> where F: 'a + Fn(A) -> B
Modifies the return value of the program.
Seen differently, it lifts a function from
A
to B
into a function from Program<I, A>
to Program<I, B>
.
Equivalent to the monadic liftM
.