I have a situation where I am expecting some quoted elixir code to be an atom. If the wrong quoted code is passed in I want to raise an error and show what the wrong code was.
Simplest way to show what I need is with an example.
quoted_code = quote do: %{}
"%{}" = some_func(quoted_code)
You can achieve this with Macro.to_string/2
Macro.to_string(quote do: %{}) #=> "%{}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With