by Grimm1 · 5y ago · 0 comments
I think there is a limit to how many things you should handle in a with statement, but the same goes for regular pipes as well.
Instead of this...
with {:ok, response} <- call_service(data),
{:ok, decoded} <- parse_response(response) do
decoded
end
Maybe just do this... {:ok, response} = call_service(data)
{:ok, decoded} = parse_response(response)
decoded
Or even this... data
|> call_service!() # don't bother returning ok tuples
|> parse_response!() # just use bang methods!