Skip to content

Instantly share code, notes, and snippets.

@lasseebert
Created September 3, 2019 19:36
Show Gist options
  • Save lasseebert/2f10128bf89fc32a25900e29f855240e to your computer and use it in GitHub Desktop.
Save lasseebert/2f10128bf89fc32a25900e29f855240e to your computer and use it in GitHub Desktop.
defmodule DialyzerTest do
@spec a() :: :ok | :error | :another_error
def a do
[:ok, :error, :another_error] |> Enum.random()
end
@spec c() :: :ok | :error
def c do
with :ok <- a() 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