monex v0.1.16 MonEx.Arrows

Arrows module inroduces short syntax for MonEx.map/2 and MonEx.flat_map/2.

Link to this section Summary

Functions

Alias for MonEx.map/2 to be used in infix position

Alias for MonEx.flat_map/2 to be used in infix position

Link to this section Functions

Link to this function

m ~> f
m(a, b) ~> (a -> c) :: m(c, b) when a: any(), b: any(), c: any()

Alias for MonEx.map/2 to be used in infix position.

Example:

iex> f = fn (x) ->
...>   x * 2
...> end
...> some(5) ~> f
some(10)

...> none() ~> f
none()
Link to this function

m ~>> f
m(a, b) ~>> (a -> m(c, d)) :: m(c, d)
when a: any(), b: any(), c: any(), d: any()

Alias for MonEx.flat_map/2 to be used in infix position.

Example:

iex> f = fn (x) ->
...>   ok(x * 2)
...> end
...> ok(5) ~>> f
ok(10)

...> error("Error") ~>> f
error("Error")