Helpers for planner steps that run over a list and stop at the first error.
Summary
Functions
Runs fun (returning :ok | {:error, error}) on each item: :ok, or the first error.
Maps fun (returning {:ok, value} | {:error, error}) over enum: {:ok, values} in
order, or the first error.
Folds fun (returning {:ok, acc} | {:error, error}) over enum, stopping at the
first error.
Functions
@spec all_ok(Enumerable.t(), (term() -> :ok | {:error, term()})) :: :ok | {:error, term()}
Runs fun (returning :ok | {:error, error}) on each item: :ok, or the first error.
@spec map_ok(Enumerable.t(), (term() -> {:ok, term()} | {:error, term()})) :: {:ok, list()} | {:error, term()}
Maps fun (returning {:ok, value} | {:error, error}) over enum: {:ok, values} in
order, or the first error.
@spec reduce_ok(Enumerable.t(), term(), (term(), term() -> {:ok, term()} | {:error, term()})) :: {:ok, term()} | {:error, term()}
Folds fun (returning {:ok, acc} | {:error, error}) over enum, stopping at the
first error.