-
-
Save krainboltgreene/a5644d1d69cf2b24c983e9d5a9a559a7 to your computer and use it in GitHub Desktop.
This file contains 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 A do | |
# What you can write in Elixir | |
@spec a(String.t()) :: integer | |
def a(b) when is_bitstring(b) do | |
if b == "hello" do | |
1 | |
else | |
2 | |
end | |
end | |
@spec a(any) :: false | |
def a(_), do: false | |
end |
This file contains 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
# What Erlang see | |
@spec a(String.t() | any) :: integer | false | |
# Note, that what this suggests is that somehow a() an be given a string and | |
# return false. This will never and can never happen. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment