Skip to content

Instantly share code, notes, and snippets.

@larshesel
Last active August 29, 2015 14:16
Show Gist options
  • Save larshesel/6dc8a3fbb62db5b7f2b0 to your computer and use it in GitHub Desktop.
Save larshesel/6dc8a3fbb62db5b7f2b0 to your computer and use it in GitHub Desktop.
defmodule Specs do
@type network :: :mainnet | :testnet3
@spec magic(network) :: binary
defp magic(:mainnet) do
<<0xf9,0xbe,0xb4,0xd9>>
end
defp magic(:testnet3) do
<<0x0b, 0x11, 0x09, 0x07>>
end
end
iex(1)> c "defp.ex"
defp.ex:4: warning: function magic/1 is unused
== Compilation error on file defp.ex ==
** (CompileError) defp.ex:3: spec for undefined function Specs.magic/1
(stdlib) lists.erl:1336: :lists.foreach/2
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
** (exit) shutdown: 1
(elixir) lib/kernel/parallel_compiler.ex:199: Kernel.ParallelCompiler.handle_failure/5
(elixir) lib/kernel/parallel_compiler.ex:182: Kernel.ParallelCompiler.wait_for_messages/8
(elixir) lib/kernel/parallel_compiler.ex:55: Kernel.ParallelCompiler.spawn_compilers/3
(iex) lib/iex/helpers.ex:94: IEx.Helpers.c/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment