Theoria.Equation.Matcher.Spec (theoria v0.5.0)

Copy Markdown View Source

Experimental/internal API for 0.2; subject to change before 0.3. Checked declaration package for a generated matcher.

Summary

Functions

Builds a checked matcher declaration spec from equation metadata.

Builds an explicit checked indexed matcher declaration spec from equation metadata.

Converts the matcher spec to environment metadata.

Returns the matcher type for supported equation fragments.

Returns the matcher value for supported equation fragments.

Types

mode()

@type mode() :: :source_aligned | :matcher | :indexed_matcher

t()

@type t() :: %Theoria.Equation.Matcher.Spec{
  equation_identities: [atom()],
  info: Theoria.Equation.Matcher.Info.t(),
  level_params: [atom()],
  mode: mode(),
  name: atom(),
  schema: Theoria.Equation.Schema.t() | nil,
  source: atom(),
  type: Theoria.Term.t(),
  value: Theoria.Term.t()
}

Functions

from_info(info, opts \\ [])

@spec from_info(
  Theoria.Equation.Info.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Builds a checked matcher declaration spec from equation metadata.

indexed_from_info(info, opts \\ [])

@spec indexed_from_info(
  Theoria.Equation.Info.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Builds an explicit checked indexed matcher declaration spec from equation metadata.

metadata(spec)

@spec metadata(t()) :: Theoria.Env.Matcher.t()

Converts the matcher spec to environment metadata.

type_for(info, schema, source_type, atom)

@spec type_for(
  Theoria.Equation.Matcher.Info.t(),
  Theoria.Equation.Schema.t() | nil,
  Theoria.Term.t(),
  mode()
) :: {:ok, Theoria.Term.t()} | {:error, term()}

Returns the matcher type for supported equation fragments.

value_for(info, schema, source_value, atom)

@spec value_for(
  Theoria.Equation.Matcher.Info.t(),
  Theoria.Equation.Schema.t() | nil,
  Theoria.Term.t(),
  mode()
) :: {:ok, Theoria.Term.t()} | {:error, term()}

Returns the matcher value for supported equation fragments.