PtcRunner.Lisp.ValuePreview (PtcRunner v0.14.0)

Copy Markdown View Source

Heap-proportional structural previews for human and model observations.

Unlike PtcRunner.Lisp.Format, this module is deliberately bounded. Its default pass samples collections and preserves sibling shape while enforcing depth, node, string, character, and UTF-8 byte ceilings. When the shape pass reports only the string cap and no explicit string ceiling was supplied, one bounded greedy pass may replace the preview with an exact rendering if every part fits all remaining ceilings. Otherwise the original shape-preserving preview wins.

Neither pass recursively sanitizes a complete value or materializes a complete collection before applying the traversal ceilings.

Preview results are presentation metadata only. Callers must never turn a preview failure into an evaluation failure or use a preview as the retained continuation value.

Summary

Functions

Renders a preview with a bounded visible truncation notice.

Types

option()

@type option() ::
  {:max_chars, pos_integer()}
  | {:max_bytes, pos_integer()}
  | {:max_items, pos_integer()}
  | {:max_depth, non_neg_integer()}
  | {:max_nodes, pos_integer()}
  | {:max_string_chars, pos_integer()}

Functions

render(value, opts \\ [])

render_with_notice(value, opts \\ [])

@spec render_with_notice(term(), [option()]) :: PtcRunner.Lisp.ValuePreview.Result.t()

Renders a preview with a bounded visible truncation notice.