OkThen.Result.retag

You're seeing just the function retag, go back to OkThen.Result module for more information.
Link to this function

retag(result, new_tag)

Specs

retag(result_input(), new_tag) :: new_tag | {new_tag, any()}
when new_tag: atom()

If result is tagged :ok, replaces the tag with new_tag, returning a new tagged tuple.

Equivalent to tagged_retag(result, :ok, new_tag). See tagged_retag/3.

Examples

iex> :ok |> Result.retag(:none)
:none

iex> {:ok, "hello"} |> Result.retag(:error)
{:error, "hello"}

iex> {:ok, 1, 2} |> Result.retag(:error)
{:error, {1, 2}}

iex> {:error, 1, 2} |> Result.retag(:ok)
{:error, 1, 2}

iex> :ok |> Result.retag("string")
** (ArgumentError) Expected atom as new tag, got: "string".

iex> "bare value" |> Result.error_retag(:error)
"bare value"