 
   defmacro defspec({name, line, args},[{:do, returns}]) do
     spec = typespec({{:fun, line, args}, returns}, [], __CALLER__)
-    code = quote do: {{unquote(name), unquote(length(args))}, [unquote(spec)]}
+    code = Macro.escape { { name, length(args) }, [spec] }
     quote do
       @__specs__ unquote(code)
       {:spec, unquote(code)}


  defp remote_type({remote, line, name, arguments}, vars, caller) do
    arguments = lc arg inlist arguments, do: typespec(arg, vars, caller)
    quote do: {:remote_type, unquote(line), [unquote(remote), unquote(name), unquote(arguments)]}
  end

  defp collect_union({:"|", _, [a, b]}), do: [b|collect_union(a)]
  defp collect_union(v), do: [v]

  defp typespec({:"|", line, [_,_]} = orexpr, vars, caller) do
    union = lc e inlist :lists.reverse(collect_union(orexpr)), do: typespec(e, vars, caller)
    quote do: {:type, unquote(line), :union, lc e inlist unquote(union), do: e}
  end

  defp typespec({:"<<>>", line, []}, _,_) do
    quote do: {:type, unquote(line), :binary, [{:integer, unquote(line), 0}, {:integer, unquote(line), 0}]}
  end

  defp typespec({:"<<>>", line, [{:"|", _, [{:_, line1, atom}, {:"*", _, [{:_, line2, atom}, unit]}]}]}, _, _) when atom in [:quoted, nil] do
    quote do: {:type, unquote(line), :binary, [{:integer, unquote(line1), 0}, {:integer, unquote(line2), unquote(unit)}]}
  end

  defp typespec({:"<<>>", line, [{:"|", line1, [{:_, line2, atom}, base]}]}, _, _) when atom in [:quoted, nil] do
    quote do: {:type, unquote(line), :binary, [{:integer, unquote(line1), unquote(base)}, {:integer, unquote(line2), 0}]}
  end
  
  defp typespec({:"..", line, args}, vars, caller) do

  end

  defp typespec({:"{}", line, []}, _, _) do
     {:type, line, :tuple, :any}
  end

  defp typespec({:"{}", line, t}, vars, caller) when is_list(t) do
     {:type, line, :tuple, lc(e inlist t, do: typespec(e, vars, caller))}
  end

  defp typespec({:fun, line, arguments}, vars, caller) when is_list(arguments) do
