Struct operational::Kleisli [] [src]

pub struct Kleisli<'a, I: Instr<Return = A>, A, B> { /* fields omitted */ }

The Kleisli arrow from A to Program<I, B>.

Methods

impl<'a, I: Instr<Return = A>, A> Kleisli<'a, I, A, A>
[src]

Creates the identity arrow.

Example

use operational::Kleisli;
use operational::instr::identity;

let k = Kleisli::new();
assert_eq!(k.run(42), identity(42));

impl<'a, I: 'a + Instr<Return = A>, A, B> Kleisli<'a, I, A, B>
[src]

Appends the given function to the tail of the arrow. This corresponds to closure composition at the codomain (post-composition).

Example

use operational::{Kleisli, point};
use operational::instr::identity;

let k = Kleisli::new().append(|x| point(x + 1));
assert_eq!(k.run(42), identity(43));

Given an input, runs the arrow to completion and return the resulting program.