connect
|> receive_image
|> resize
|> rotate
|> save
def resize({:error, _}=error), do:errorwith {:ok, pid} <- connect,
{:ok, image} <- receive_image(pid),
{:ok, resized_image} <- resize(image),
{:ok, rotated_image} <- rotate(resized_image),
:ok <- save(rotated_image)
do: IO.puts "saved"Hi!
with is the right tool when you want this kind of error handling in these function pipelines :)
Cheers,
Louis
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/1dc86df2-eca0-4fa5-b883-7b9c2df36444%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--