focus v0.2.1 Prism
Prisms are like lenses, but used when the view focused on may not exist.
This includes sum types; although not backed by an explicit Maybe type, the [{:ok, any} | {:error}] convention is explicitly supported as a value that a prism can focus on.
Summary
Types
Functions
A prism that matches an {:error, } tuple. Note that on a successful match, view/set/over will return {:ok, }
Examples
iex> error = Prism.error iex> error |> Focus.view({:error, 5})
iex> error |> Focus.set({:error, 5}, “Banana”)
iex> error |> Focus.view({:ok, :oops}) {:error, {:prism, :bad_path}}