kleisli composition

Method for composing monadic actions.

Forward kliesli arrow, >=> has type

(a -> m b) -> (b -> m c) -> a -> m c

The arrow takes two functions that each return a monad value, and a third value (the chain's initial input), applies the first function, and then binds this value to the next function.

f >=> g = \x -> f x >>= g

The backward arrow <=< flips the first two arguments.

Back to index