Skip to content

Commit

Permalink
minor type refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
aenglisc committed Nov 10, 2020
1 parent d8f7ff4 commit cd5a3ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/f.erl
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ is_curried_(F) when not is_function(F, 1) -> false;
is_curried_(F) when is_function(F, 1) -> true.

-spec
curry_(F) -> curried(T) when F :: fun((...) -> T).
curry_(F) -> curried(T) when F :: func(T).
curry_(F) when not is_function(F) -> not_a_function(F);
curry_(F) when is_function(F, 0) -> not_curriable(F);
curry_(F) when is_function(F, 1) -> id_(F);
curry_(F) when is_function(F) -> curried(F, function_arity(F), []).

-spec
curried(F, arity(), list()) -> curried(T) when F :: fun((...) -> T).
curried(F, arity(), list()) -> curried(T) when F :: func(T).
curried(F, Arity, Args) when Arity =:= 1 ->
fun(Arg) -> apply(F, lists:reverse([Arg | Args])) end;
curried(F, Arity, Args) when Arity =/= 1 ->
Expand Down Expand Up @@ -360,7 +360,7 @@ applicator(X, F) when is_function(F, 1) -> F(X);
applicator(_, _) -> too_many_arguments().

-spec
function_arity(F) -> non_neg_integer() when F :: fun().
function_arity(F) -> non_neg_integer() when F :: func().
function_arity(F) -> erlang:element(2, erlang:fun_info(F, arity)).

-spec
Expand Down

0 comments on commit cd5a3ae

Please sign in to comment.