   Prints documentation for the given callback function with any arity.
   """
   def b(mod, fun) when is_atom(mod) and is_atom(fun) do
-    case print_behaviour_docs(mod, &match?({{^fun, _}, _}, &1)) do
+    case print_behaviour_docs(mod, &match?({^fun, _}, elem(&1, 0))) do
       :ok        -> :ok
       :no_beam   -> nobeam(mod)
       :no_docs   -> puts_error("#{inspect mod} was not compiled with docs")

    end
  end

  defp print_callback_doc(fun, arity, spec, docs) do
    if doc = find_doc(docs, fun, arity, 3) do
      print_callback_doc(doc, spec)
      :ok
    end
  end

  defp print_callback_doc({{fun, _}, _line, kind, doc}, spec) do
    definition =
      Typespec.spec_to_ast(fun, spec)
      |> Macro.to_string

    print_doc("#{kind}callback #{definition}", doc)
  end

  @doc """
  Prints the types for the given module.

    case get_behaviour_docs(mod) do
      {callbacks, docs} ->
        printed =
          Enum.filter_map docs, filter, fn
            {{fun, arity}, _, :defmacro, doc} ->
              print_callback_doc(fun, :defmacro, doc, :"MACRO-#{fun}", arity + 1, callbacks)
            {{fun, arity}, _, kind, doc} ->
              print_callback_doc(fun, kind, doc, fun, arity, callbacks)
          end
        if Enum.any?(printed), do: :ok, else: :not_found

