Hi,
What would be the Erlang equivalent for the with
special form like:
with {:ok, width} <- Map.fetch(opts, :width),
{:ok, height} <- Map.fetch(opts, :height) do
{:ok, width * height}
else
:error -> {:error, :wrong_data}
end
I’m switching back and forth between the languages and still didn’t found a nice abstraction in Erlang for this.
Thanks,
Qqwy
2
Elixir’s with
compiles to a nested case
-statement. Unfortunately Erlang does not provide such an abstraction itself.
1 Like
Yes, nested case statements is the problem I’m trying to solve 
There is no equivalent, although there are libraries such as erlando that implement the do-notation.
4 Likes
Ooo I hadn’t ran across erlando in a long time, that’s a blast from the past. ^.^
1 Like