View Source Using Matcha
setting-up
Setting up
The latest version of Matcha can be installed in scripts or iex via:
Mix.install([{:matcha, github: "christhekeele/matcha", tag: "stable"}], force: true)
IO.puts("Installed matcha version: #{Application.spec(:matcha, :vsn)}")The primary entrypoint to Matcha concepts are the macros in the Matcha module,
so we require it to make them available:
require Matcha
Matcha.__info__(:macros)
functionality-overview
Functionality Overview
As the macros list suggests, Matcha provides easy ways to:
Create match patterns
Matcha.Patternfunctions can then be used to filter data through them.Create match specifications
Matcha.Specfunctions can then be used to filter and map data with them.Trace activity in the current runtime
Matcha.Tracefunctions can be used to further interact with the tracing engine.
Let's play with each in turn.
match-patterns
Match Patterns
spec =
Matcha.spec do
{x, y, z} -> {x, y, z}
end