Lemma.Show (lemma_engine v0.9.10)

Copy Markdown View Source

Typed projection of the JSON map returned by Lemma.show/4: spec interface and resolved temporal window.

Each data entry's type and each rules entry's type are raw LemmaType JSON maps (a Rust discriminated union tagged by "kind"). Rule values are Lemma.ShowRule structs (type, branches, depends_on_rules). meta values are raw LiteralValue JSON maps. Pattern-match on those tags directly rather than through a parallel Elixir struct hierarchy — see Lemma.ShowData and Lemma.ShowRule.

Lemma.show/4 itself still returns the plain decoded JSON map for backward compatibility; call from_map/1 on that map to get a typed struct.

Summary

Functions

Builds a Lemma.Show struct from the map decoded from Lemma.show/4's JSON.

Types

t()

@type t() :: %Lemma.Show{
  commentary: String.t() | nil,
  data: %{optional(String.t()) => Lemma.ShowData.t()},
  effective_from: String.t() | nil,
  effective_to: String.t() | nil,
  meta: %{optional(String.t()) => map()},
  rules: %{optional(String.t()) => Lemma.ShowRule.t()},
  source_type: String.t() | map() | nil,
  spec: String.t(),
  start_line: non_neg_integer(),
  versions: [Lemma.ShowVersion.t()]
}

Functions

from_map(map)

@spec from_map(map()) :: t()

Builds a Lemma.Show struct from the map decoded from Lemma.show/4's JSON.

Raises KeyError if a required field (spec, start_line, data, rules) is missing — that shape never comes from a real Lemma.show/4 call, so a missing key here is a caller bug, not a recoverable Show variant.