Lemma.Show (lemma_engine v0.9.4)

Copy Markdown View Source

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

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

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()) => map()},
  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.