Monad

Definitions

def <=<(f1: b -> m[c] \ ef1, f2: a -> m[b] \ ef2): a -> m[c] \ ef1 + ef2Source

<=< is an operator alias for kleisliRight.

def =<<(k: a -> m[b] \ ef, x: m[a]): m[b] \ efSource

=<< is an operator alias for flatMap.

def >=>(f1: a -> m[b] \ ef1, f2: b -> m[c] \ ef2): a -> m[c] \ ef1 + ef2Source

>=> is an operator alias for kleisliLeft.

def >>=(x: m[a], k: a -> m[b] \ ef): m[b] \ efSource

>>= is the operator =<< with its arguments flipped.

>>= is the monadic bind operator.

def flatten(x: m[m[a]]): m[a]Source

The monadic join operator. Flatten x - a monadic action nested in an outer monadic layer - to a single layer.

E.g. for the Option monad: flatten(Some(Some(1))) becomes Some(1).

def kleisliLeft(f1: a -> m[b] \ ef1, f2: b -> m[c] \ ef2, x: a): m[c] \ ef1 + ef2Source

The left-to-right Kleisli composition operator for monads.

Map x with the monadic function f1 and then map its result with the function f2.

def kleisliRight(f1: b -> m[c] \ ef1, f2: a -> m[b] \ ef2, x: a): m[c] \ ef1 + ef2Source

The right-to-left Kleisli composition operator for monads.

Map x with the monadic function f2 and then map its result with the function f1.