March Docs

ShellRender

ShellRender: the combinators march --shell renders a result with.

The shell (bin/shell_cmd.ml, bin/shell_render_gen.ml) compiles each input into a fragment that returns its result as a String. It generates, from the result's static type, a renderer built from these functions: one per record, tuple and ADT the type reaches, each passing the element limit down. The rules (R5.7 of specs/plans/2026-09-28-observe-recon-shell-plan.md):

  • A collection (List, Array, Map, Set, and the other stdlib containers:
HashMap, OrderedMap, SortedSet, Deque, Queue, RRB.Vec, NativeArray) shows
at most `limit` elements and then `… n more`.  A string shows at most `limit` characters (codepoints),
quoted and escaped, then `… n more chars`.  The limit applies at every
depth; `limit <= 0` means no limit.
  • Records, tuples and constructors render field by field, in derive Show's
form.
  • A hand-written Show impl's string is cut at 16 KiB (show_cut).

Functions

fnanon_recordanon_record(fields : List(String)) : String#

An anonymous record: { a: 1, b: 2 }. Each field arrives rendered as a: 1.

fnarrayarray(v, limit : Int, f) : String#

An Array: Array[1, 2, … n more], as list.

fnctorctor(name : String, args : List(String)) : String#

A constructor with arguments: Name(a, b).

fndequedeque(d, limit : Int, f) : String#

A Deque: Deque[1, 2, … n more], as list, front to back.

fnhash_maphash_map(m, limit : Int, fk, fv) : String#

A HashMap: HashMap{k => v, … n more}, as map, in the map's hash order.

fnlistlist(xs : List(a), limit : Int, f : a -> String) : String#

A list, each element rendered by f: [1, 2, … 98 more] at most limit elements (all when limit <= 0).

fnmapmap(m, limit : Int, fk, fv) : String#

A Map: Map{k => v, … n more}, keys by fk and values by fv, at most limit entries, in the map's iteration order.

fnnative_arraynative_array(xs : List(a), limit : Int, f : a -> String) : String#

A NativeArray, given as the list of its elements (its family's to_list_*): NativeArray[1, 2, … n more], as list.

fnordered_mapordered_map(m, limit : Int, fk, fv) : String#

An OrderedMap: OrderedMap{k => v, … n more}, as map, in key order.

fnqueuequeue(q, limit : Int, f) : String#

A Queue: Queue[1, 2, … n more], as list, front to back.

fnquotequote(s : String) : String#

s as a March string literal: quoted, with double quotes, backslashes, control bytes and an interpolation opener escaped.

fnrawraw(s : String, limit : Int) : String#

s unquoted, cut after limit codepoints with … n more chars (limit <= 0 keeps all of it): the shell prints a string at the top of a result this way, and the payload of a top-level one-field constructor (Ok("…"), as Actor.inspect_state returns its already rendered state).

fnrecordrecord(name : String, fields : List(String)) : String#

A named record, in derive Show's form: Name { a = 1, b = 2 }. Each field arrives rendered as a = 1.

fnrrb_vecrrb_vec(v, limit : Int, f) : String#

An RRB vector: RRB.Vec[1, 2, … n more], as list, in index order.

fnsetset(s, limit : Int, f) : String#

A Set: Set{1, 2, … n more}, as list, in the set's iteration order.

fnshow_capshow_cap() : Int do 16384 end#

The most bytes show_cut keeps of a hand-written Show impl's string: 16 KiB.

fnshow_cutshow_cut(s : String) : String#

A hand-written Show impl's string, cut at 16 KiB (on a codepoint boundary) with … (n more bytes); it cannot take an element limit.

fnsorted_setsorted_set(s, limit : Int, f) : String#

A SortedSet: SortedSet{1, 2, … n more}, as list, in order.

fnstringstring(s : String, limit : Int) : String#

s quoted (see quote), cut after limit codepoints with … n more chars. limit <= 0 keeps all of it.

fntupletuple(parts : List(String)) : String#

A tuple: (a, b).