Tyler A. Young 🧑🏻💻⚗️ on Nostr: Okay #ElixirLang folks, I need your ideas... I'd like to override the fallback ...
Okay #ElixirLang folks, I need your ideas...
I'd like to override the fallback Inspect protocol for all structs to redact certain sensitive keys. For instance, I'd like the backtrace of:
Enum.reduce(%User{password: "secret"}, fn _, _ -> :ok end)
...to redact "secret".
I'd really like to avoid relying on devs to remember to derive the Inspect protocol on every struct they create.
I tried to do:
defimpl Inspect, for: Map do
...
end
...but Elixir is displeased with me (inscrutable errors).
Published at
2025-04-01 13:09:44Event JSON
{
"id": "f6cb820188ce65c9a29b149a3689d481cd47ec9632cf3390581cf4070d0a754b",
"pubkey": "6bb1d7b21dbaffc990baad05f8f0d8480f68a330beaab59864275f4300d3c82e",
"created_at": 1743512984,
"kind": 1,
"tags": [
[
"t",
"elixirlang"
],
[
"proxy",
"https://fosstodon.org/users/tylerayoung/statuses/114262866922822003",
"activitypub"
]
],
"content": "Okay #ElixirLang folks, I need your ideas...\n\nI'd like to override the fallback Inspect protocol for all structs to redact certain sensitive keys. For instance, I'd like the backtrace of:\n\nEnum.reduce(%User{password: \"secret\"}, fn _, _ -\u003e :ok end)\n\n...to redact \"secret\".\n\nI'd really like to avoid relying on devs to remember to derive the Inspect protocol on every struct they create.\n\nI tried to do:\n\ndefimpl Inspect, for: Map do\n ...\nend\n\n...but Elixir is displeased with me (inscrutable errors).",
"sig": "dcc4a1acb1b594093c2f148a5e5f5454b5573e168cc9ec3808c5decbb5ff40488ab3a0b26354689affafae44875a04a0777f7749790abcc88b5e1519a48a3a8d"
}