Circe.sigil_m

You're seeing just the macro sigil_m, go back to Circe module for more information.
Link to this macro

sigil_m(arg, modifiers)

View Source (macro)

Handles the sigil ~m to match on code's ast.

This is meant as a symmetric tool to quote/2.

The sigil should be used within a matching context:

You can directly match code:

iex> import Circe
iex> ast = quote do {:banana} end
{:{}, [], [:banana]}
iex> match?(~m/{:banana}/, ast)
true

You can ignore parts of the code by combining interpolation and an underscore:

iex> import Circe
iex> ast = quote do {:test_atom_pls_ignore} end
{:{}, [], [:test_atom_pls_ignore]}
iex> match?(~m/{#{_}}/, ast)
true

Instead of ignoring parts of the code, you can bind it to a variable:

iex> import Circe
iex> ~m/{#{banana}}/ = quote do {:split} end
{:{}, [], [:split]}
iex> banana
:split

Sometime the ast that would correspond to the code you wrote is wrapped in a list, (typically concerning the -> operator), you can unwrap it with the modifier w:

iex> import Circe
iex> ast = quote do case 4 do 1 -> :one ; 2 -> :two ; 3 -> :three ; _ -> :too_big end end
iex> ~m/case #{_} do #{clauses} end/ = ast
iex> Enum.any?(clauses, fn ~m/(#{_} -> :too_big)/ -> true ; _ -> false end)
false
iex> Enum.any?(clauses, fn ~m/(#{_} -> :too_big)/w -> true ; _ -> false end)
true

The equivalent to unquote_splicing/3 is #{..._}:

iex> import Circe
iex> ~m/{#{...desserts}}/ = quote do {:banana, :split, :peach, :melba} end
{:{}, [], [:banana, :split, :peach, :melba]}
iex> desserts
[:banana, :split, :peach, :melba]