Getting typer to work for me
Torben Hoffmann
torben.lehoff@REDACTED
Tue Dec 15 09:52:27 CET 2009
Hi.
I have the following code:
-module(ups).
-export([fup/1]).
-spec fup(integer()) -> {'ok',integer()} | 'wrong'.
fup(1) ->
{ok,2};
fup(_) ->
not_okay.
And I sort of expected that typer would find the problem in the fup(_) case,
but I have to use
dialyzer -Wspecdiffs --src ups.erl
in order to get the warning I want (namely that the code does not match the
spec), but the dialyzer docs warns against using this option.
Am I asking too much? Should I shake off more of my SML heritage? Am I doing
something wrong?
Any advice appreciated!
Cheers,
Torben
--
http://www.linkedin.com/in/torbenhoffmann
More information about the erlang-questions
mailing list