Created
April 26, 2016 10:26
-
-
Save tonini/e45482e70fbe9ec90c595b40540772e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defmodule Foo do | |
| def bar do | |
| with {:ok, width} <- Map.fetch(opts, :width), | |
| {:ok, height} <- Map.fetch(opts, :height) do | |
| {:ok, width * height} | |
| else | |
| :error -> | |
| {:error, :wrong_data} | |
| end | |
| end | |
| end | |
| defmodule Foo do | |
| def bar do | |
| with {:ok, width} <- Map.fetch(opts, :width), | |
| {:ok, height} <- Map.fetch(opts, :height), | |
| do: {:ok, width * height}, | |
| else: {:error, :wrong_data} | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment