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

The case Pure(a) means that the program contains no instructions and just returns the result a.

The case Then(instr, k) means that the first instruction is instr and the remaining program is given by the kleisli arrow k.

Methods

impl<'a, I: 'a + Instr, A> Program<'a, I, A>
[src]

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.

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.

Trait Implementations

impl<'a, I: 'a + Instr, A: PartialEq> PartialEq for Program<'a, I, A>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a, I: 'a + Instr, A: Debug> Debug for Program<'a, I, A>
[src]

Formats the value using the given formatter.