Last active
September 3, 2019 19:50
-
-
Save lasseebert/3aabf7cff1abe3aa5002e6ce779a9e0e 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 DialyzerTest do | |
@spec a() :: :ok | :error | |
def a do | |
[:ok, :error] |> Enum.random() | |
end | |
@spec b() :: :ok | :another_error | |
def b do | |
[:ok, :another_error] |> Enum.random() | |
end | |
@spec c() :: :ok | :error | |
def c do | |
with :ok <- a(), | |
:ok <- b() do | |
:ok | |
else | |
:error -> :error | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment