<div dir="ltr">let's say we have two function specifications:<div><br></div><div>-spec foo(list(), atom()) -> boolean().</div><div><br></div><div>and</div><div><br></div><div>-spec bar(list(), atom()) -> boolean().<br></div><div><br></div><div>is it possible to do something like this: </div><div><br></div><div>-type my_f() :: fun ((list(),atom())->boolean()).</div><div><br></div><div>and then: </div><div><br></div><div>-spec foo :: my_f().</div><div>-spec bar :: my_f().</div><div><br></div><div>i couldn't find a way of doing this</div><div>this would remove code duplication in type specifications </div><div>also i think it would make code *much* clearer </div><div><br></div><div>for example (bad one): </div><div><br></div><div>in higher order function </div><div><br></div><div>%% module1.erl</div><div>-spec hfoo(T,F) -> ok when </div><div>    T :: any(),</div><div>    F :: my_f().</div><div><br></div><div>-export_type([my_f/0]).</div><div><br></div><div>%% module2.erl</div><div><br></div><div>-spec my_algorithm :: module1:my_f().</div><div><br></div><div>here i can express with type specification that i'm implementing function that will be compatible with module1:hfoo/2 and possible others </div><div><br></div><div>is there way to achieve this in current erlang and if not are there any plans to include something similar in future versions?</div><div><br></div></div>