Created
April 1, 2020 10:14
-
-
Save houmanka/0705ccf51c59a7a90971a63914f66546 to your computer and use it in GitHub Desktop.
Changed all are in the actual project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decrement(%Monad.Result{type: :ok} = state) do | |
state.value | |
|> decrement | |
end | |
def increment( | |
%Monad.Result{type: :ok} = first, | |
%Monad.Result{type: :ok} = second ) do | |
second = second.value |> Enum.count | |
increment(first.value, second) | |
end | |
def combine( | |
%Monad.Result{type: :ok} = first, | |
%Monad.Result{type: :ok} = second ) do | |
combine(first.value, second.value) | |
end | |
def filter(%Monad.Result{type: :ok} = list), do: list.value |> filter() | |
def sum_of(%Monad.Result{type: :ok} = list), do: list.value |> sum_of | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment