In my quest to learn more about this library I am trying to chain a Result Monad several times in a function.
I understand this is achieved via the fmap, a function which takes a function and a Monad and returns a Monad.
defmodule TestMonadex do
use Monad.Operators
import Monad.Result
# This wont work
def p2(x) do
x
|> success()
<|> (&plus_1/1)
<|> (&plus_1/1)
end
defp plus_1(n), do: n + 1
end
Problem
The problem here is that according to the documentation, Result Monad does not implement the fmap:
Background
In my quest to learn more about this library I am trying to chain a Result Monad several times in a function. I understand this is achieved via the fmap, a function which takes a function and a Monad and returns a Monad.
Problem
The problem here is that according to the documentation, Result Monad does not implement the
fmap
:https://hexdocs.pm/monadex/Monad.Result.html#content
Question