diff --git a/lib/stack.ex b/lib/stack.ex
index a280d7c..f75604f 100644
--- a/lib/stack.ex
+++ b/lib/stack.ex
@@ -3,5 +3,15 @@ defmodule Stack do
def to_string(stack), do: to_string(stack, [])
def to_string([], acc), do: acc |> Enum.reverse() |> Enum.join("\n")
- def to_string([elt | rest], acc), do: to_string(rest, [inspect(elt) | acc])
+ def to_string([{module, fun, arity, [file: file, line: line]} | rest], acc) do
+ str = "#{module}.#{fun}/#{arity} in #{file}:#{line}"
+ to_string(rest, [str | acc])
+ end
+ def to_string([{module, fun, arity, _} | rest], acc) do
+ str = "#{module}.#{fun}/#{arity}"
+ to_string(rest, [str | acc])
+ end
+ def to_string([elt | rest], acc) do
+ to_string(rest, [inspect(elt) | acc])
+ end
end