Matcha (Matcha v0.1.1) View Source

First-class match specification and match patterns for Elixir.

The BEAM VM Match patterns and specs

Link to this section Summary

Link to this section Functions

Link to this macro

pattern(context \\ nil, pattern)

View Source (macro)

Macro for building a Matcha.Pattern.

The context may be nil, :table, :trace, or a Matcha.Context module.

Examples

iex> require Matcha
...> Matcha.pattern({x, y})
#Matcha.Pattern<{:"$1", :"$2"}>
Link to this macro

spec(context \\ nil, source)

View Source (macro)

Macro for building a Matcha.Spec.

The context may be nil, :table, :trace, or a Matcha.Context module.

Examples

iex> require Matcha
...> Matcha.spec do
...>   {x, y, x} -> {y, x}
...> end
#Matcha.Spec<[{{:"$1", :"$2", :"$1"}, [], [{{:"$2", :"$1"}}]}]>