This pretty printer is inspired in the pp
macro from Crystal: [https://crystal-lang.org/api/toplevel.html#pp%28%2Aexps%29-macro]. It's quite useful while doing print debugging.
The package can be installed by adding pp
to your list of dependencies in mix.exs
:
def deps do
[
{:pp, "~> 0.1.0"}
]
end
In order to use the pp
macro, first import the PP
module in your code:
import PP
Now you're ready to use the macro:
x = 1
y = 2
pp x + y, :red
When that code is executed, it will print in the console in red color:
x + y # => 3
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/pp.