Skip to content

Instantly share code, notes, and snippets.

@pavlos
Created March 14, 2016 20:04
Show Gist options
  • Save pavlos/637507cd3baaae4e1875 to your computer and use it in GitHub Desktop.
Save pavlos/637507cd3baaae4e1875 to your computer and use it in GitHub Desktop.
defimpl Inspect, for: PID do def inspect(pid, _opts) do
"~P" <> :erlang.list_to_binary(:erlang.pid_to_list(pid)) end
end
defmodule SigilP do
defmacro sigil_P(term, modifiers)
defmacro sigil_P({:<<>>, _line, [string]}, []) when is_binary(string) do
"<#{string}>" |> String.to_char_list |> :erlang.list_to_pid
end
end
import SigilP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment