Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

nested reather

articles/nested-reather.livemd

nested reather

Section

Mix.install([
  {:reather, "~> 0.1"}
])
defmodule Example do
  use Reather

  reather next(number) do
    n <- number
    %{step: step} <- Reather.ask()

    result <- sum(n, step)
    result
  end

  reather sum(n, step) do
    n + step
  end
end
Example.next(10) |> Reather.run(%{step: 10})
Example.next(Algae.Either.Left.new(:NaN)) |> Reather.run()