Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Using Matcha

docs/guides/usage.livemd

Using Matcha

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

As the macros list suggests, Matcha provides easy ways to:

  1. Create match patterns

    Matcha.Pattern functions can then be used to find data matching them.

  2. Create match filters

    Matcha.Filter functions can then be used to filter data with them.

  3. Create match specifications

    Matcha.Spec functions can then be used to select and transform data with them.

  4. 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

spec =
  Matcha.spec do
    {x, y, z} -> {x, y, z}
  end