Polymorphic Types in Erlang Function Specifications
Enter your Erlang code here:
% Map function example -spec my_map(fun((A1) -> B), [A2]) -> [B] when is_subtype(A2,A1). my_map(F, Xs) -> [ F(X) || X <- Xs ]. map_ok() -> my_map(fun(X) -> not(X) end, [true, false]). map_fail() -> my_map(fun(X) -> X + 1 end, [true, false]).
Run Typer!
Output with transformation:
dsa
das
Output without transformation:
View transformed code