Egglog.Snapshot (EgglogElixir v0.1.0)

Copy Markdown

Helpers for egglog JSON snapshots.

The wrapper asks native egglog to serialize snapshots. This module only decodes that JSON and computes small summaries that are convenient in tests, notebooks, and debugging sessions.

Summary

Functions

Returns the serialized e-class metadata map from a decoded or raw JSON snapshot.

Decodes an egglog JSON snapshot.

Bang variant of decode/1.

Returns the serialized node map from a decoded or raw JSON snapshot.

Counts serialized e-nodes by operator name.

Returns a compact summary of an egglog JSON snapshot.

Types

decoded()

@type decoded() :: map()

Functions

classes(snapshot)

@spec classes(String.t() | map()) :: map()

Returns the serialized e-class metadata map from a decoded or raw JSON snapshot.

decode(json)

@spec decode(String.t() | map()) :: {:ok, decoded()} | {:error, term()}

Decodes an egglog JSON snapshot.

Accepts a raw JSON string, a snapshot map returned by Egglog.snapshot/3, or a run result containing a native :snapshot.

decode!(snapshot)

@spec decode!(String.t() | map()) :: decoded()

Bang variant of decode/1.

nodes(snapshot)

@spec nodes(String.t() | map()) :: map()

Returns the serialized node map from a decoded or raw JSON snapshot.

operator_counts(snapshot)

@spec operator_counts(String.t() | map()) :: %{
  required(String.t()) => non_neg_integer()
}

Counts serialized e-nodes by operator name.

summary(snapshot)

@spec summary(String.t() | map()) :: map()

Returns a compact summary of an egglog JSON snapshot.

The summary is deliberately plain data so it can be displayed directly in IEx, tests, or Livebook.