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:

  1. Create match patterns

    Matcha.Pattern functions can then be used to filter data through them.

  2. Create match specifications

    Matcha.Spec functions can then be used to filter and map data with them.

  3. Trace activity in the current runtime

    Matcha.Trace functions 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