<div dir="ltr">A function's type specification can be overloaded:<div><br></div><div><font face="monospace">-spec foo(integer()) -> integer()</font></div><div><font face="monospace">       ; (atom()) -> atom().</font></div><div><br></div><div>Is there a way I can use this overloaded function's type in non-spec contexts? Like I want to say <font face="monospace">bar/1</font> takes a function as an argument that has a spec like <font face="monospace">foo/1</font> above.</div><div><br></div><div>I can think of the following options, but neither of them is exactly what I want:</div><div><br></div><div><font face="monospace">-spec bar(fun((integer() | atom()) -> integer() | atom())) -> ok.</font></div><div><font face="monospace">%% Allows a function taking an integer and returning an atom.</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">-spec bar(fun((integer()) -> integer()) | fun((atom()) -> atom())) -> ok.</font></div><div><font face="monospace">%% Allows fun erlang:atom_to_list/1, which doesn't work on integers at all.</font></div><div><br></div><div>Any better ideas? I'm sure Dialyzer can somehow represent internally the overloaded function types, but is there a way I can write them myself?</div><div><br></div><div>Tanks,</div><div>Daniel</div></div>