Monad
0.40.0
Definitions
def
<=<
[bef1mcaef2]
(
f1 :
b -> m[c] \ ef1
f2 :
a -> m[b] \ ef2
)
: a -> m[c] \ ef1 + ef2
\ Pure
with
Monad[m]
<=< is an operator alias for kleisliRight.
def
=<<
[aefmb]
(
k :
a -> m[b] \ ef
x :
m[a]
)
: m[b]
\ ef
with
Monad[m]
=<< is an operator alias for flatMap.
def
>=>
[aef1mbef2c]
(
f1 :
a -> m[b] \ ef1
f2 :
b -> m[c] \ ef2
)
: a -> m[c] \ ef1 + ef2
\ Pure
with
Monad[m]
>=> is an operator alias for kleisliLeft.
def
>>=
[maefb]
(
x :
m[a]
k :
a -> m[b] \ ef
)
: m[b]
\ ef
with
Monad[m]
>>= is the operator =<< with its arguments flipped.
>>= is the monadic bind operator.
def
flatten
[ma]
(
x :
m[m[a]]
)
: m[a]
\ Pure
with
Monad[m]
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
[aef1mbef2c]
(
f1 :
a -> m[b] \ ef1
f2 :
b -> m[c] \ ef2
x :
a
)
: m[c]
\ ef1 + ef2
with
Monad[m]
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
[bef1mcaef2]
(
f1 :
b -> m[c] \ ef1
f2 :
a -> m[b] \ ef2
x :
a
)
: m[c]
\ ef1 + ef2
with
Monad[m]
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.