Last active
December 15, 2015 02:49
-
-
Save exterm/5189682 to your computer and use it in GitHub Desktop.
Interesting example for multi-clause type spec in erlang dialyzer.
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
%% multi clause function type spec | |
-spec plus(integer(), float()) -> float(); | |
(float(), integer()) -> float(); | |
(float(), float()) -> float(); | |
(integer(), integer()) -> integer(). | |
plus(A,B) -> | |
A + B. | |
testp() -> | |
{plus(1,2), plus(1.0,2.0), plus(1,2.0), plus(1.0,2)}. | |
%% types inferred by dialyzer: | |
-spec testp() -> {integer(),float(),float(),float()}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment