El Monads v0.1.1 API Reference
Modules
This is Maybe
monad. It contains 2 public methods: m
and get
.
Use m
method to combain your actions:
result = Maybe.m(fn -> foo() end) |> Maybe.m(fn e -> bar(e) end) |> Maybe.get
.
It’ll pass the result of your actions to result
.
If any function return nil, result
will be nil
This is Try
monad. It contains 2 public methods: m
and get
.
Use m
method to combain your actions:
result = Try.m(fn -> foo() end) |> Try.m(fn e -> bar(e) end) |> Try.get
.
It’ll pass the result of your actions to result
.
If any function return or raise error, result
will be nil