When I use IO.inspect in a pipeline, I often find myself wanting to tag the output with some kind of label:
~~~ elixir
get_name()
|> IO.inspect()
|> lookup_score()
|> IO.inspect
~~~
so I sometimes write a trivial helper
~~~
def dump(value, label) do
IO.puts "#{label}: #{inspect value}"
value
end
~~~
This means I can write:
~~~ elixir
get_name()
|> dump("Name is")
|> lookup_score()
|> dump("score")
~~~
Any chance we could
1. Add a `label: "text"` option to IO.inspect?
2. Add a new signature to IO.inspect, so that
~~~~
def inspect(value, label) when is_binary(label) do
inspect(value, label: label)
end
~~~
I'd happily do the PR
Dave