[erlang-bugs] dialyzer / typer issue.

][azar <>
Thu Aug 16 14:00:38 CEST 2012

I've some code like this.

-spec my_apply(Arg,fun((Arg) -> Result)) -> Result.
my_apply(Arg,Fun) ->

-spec my_fun(good) -> ok
      ; (bad) -> error.
my_fun(good) -> ok;
my_fun(bad) -> error.

test(A) ->
    my_apply(A,fun my_fun/1).

And i whan't Dialyzer valid the A param in test/1 function,
but Typer generates this spec:

-spec test(_) -> any().

But valid is

-spec test(good) -> ok
      ; (bad) -> error.

I don't whant to write spec for functions like test/1 each time i use
How to help the dialyzer with type inference?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20120816/f49683ec/attachment.html>

More information about the erlang-bugs mailing list