Damn. That was quick.
(hides head in shame) On Monday, February 19, 2018 at 7:40:07 PM UTC-6, Paul Schoenfelder wrote: > > You can already do this today with IO.inspect(foo, label: "label") :) > > Paul > > On Mon, Feb 19, 2018 at 7:32 PM pragdave <prag...@gmail.com <javascript:>> > wrote: > >> 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 >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to elixir-lang-co...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/402e74bd-6c13-4433-b5f1-b6a42a2813d9%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elixir-lang-core/402e74bd-6c13-4433-b5f1-b6a42a2813d9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/c6e6811d-8a5d-47a5-a0a3-fb0bfee9d525%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.