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>.


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

Creates the identity arrow.


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

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

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

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


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

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

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