Multiple specifications for same function in Erlang header file

I'm trying to specify a function in a header file. Like so:

-spec update(pid(), tuple(tuple(), integer(), atom()), tuple(atom(), atom())) -> tuple(tuple(), integer(), atom()).

Now I want to add some extra specification for this function because it has multiple different parameters.

update(_Pid, {Specs, infinity, _State}, {Step}) ->
  timer:sleep(10000),
  {{Specs, infinity}, {Step}};
update(_Pid, {Specs, infinity, _State}, {ExtraInfo, Step}) ->
  timer:sleep(10000),
  {{Specs, infinity}, {ExtraInfo, Step}};
update(_Pid, {Specs, N, _State}, _Info) when N < 2 ->
  {Specs, N, stop};
update(_Pid, {Specs, N, _State}, {notTaken, Step}) ->
  {Specs, N, Step};
update(_Pid, {Specs, N, _State}, {taken, Step}) ->
  {Specs, N - 1, Step}.

So I want to add these extra specifications, for the different parameters in this function, in my header file. I don't know how to do this, could someone help me with this?

I tried to do this but it gives me compilation errors:

-spec update(pid(), tuple(tuple(), integer(), atom()), tuple(atom(), atom())) -> tuple(tuple(), integer(), atom()).
-spec update(pid(), tuple(tuple(), atom(), atom()), tuple(integer(), atom())) -> tuple(tuple(), atom(), atom()).
-spec update(pid(), tuple(tuple(), atom(), atom()), tuple(atom())) -> tuple(tuple(), atom(), atom()).

Thanks in advance.


Solution 1:

I found the answer here. I had to use the semi-colon ;. I changed this:

-spec update(pid(), tuple(tuple(), integer(), atom()), tuple(atom(), atom())) -> tuple(tuple(), integer(), atom()).
-spec update(pid(), tuple(tuple(), atom(), atom()), tuple(integer(), atom())) -> tuple(tuple(), atom(), atom()).
-spec update(pid(), tuple(tuple(), atom(), atom()), tuple(atom())) -> tuple(tuple(), atom(), atom()).

into this:

-spec update(pid(), tuple(tuple(), integer(), atom()), tuple(atom(), atom())) -> tuple(tuple(), integer(), atom());
            (pid(), tuple(tuple(), atom(), atom()), tuple(integer(), atom())) -> tuple(tuple(), atom(), atom());
            (pid(), tuple(tuple(), atom(), atom()), tuple(atom())) -> tuple(tuple(), atom(), atom()).