Specify a reference to an Elixir function @spec in another decorating function @spec

Viewed 307

Is there a way to reference the return type spec of a function in another function specs ?

defmodule Car do
  @spec beep(none()) :: String.t
  def beep do
    "beep"
  end

  @spec beep_log(none()) :: String.t
  def beep_log do
    IO.puts "beep log"
    beep
  end
end

Can the specs for beep_log be specified in something like this:

 @spec beep_log(none()) :: beep()
1 Answers
Related