Module: Rigor::Inference::HktBody
- Defined in:
- lib/rigor/inference/hkt_body.rb
Overview
ADR-20 Slice 2a — node types for the parsed body of a type-function Definition. Each node
represents one piece of a Rigor-side type expression that the reducer (HktReducer) walks
against a concrete argument list.
Slice 2a ships a programmatic constructor surface; plugin and Rigor-bundled overlay authors
may build a body tree by hand using these node types. The string-grammar parser
(HktBodyParser, Slice 2b, shipped) reads Definition#body (populated by Slice 1's
HktDirectives.parse_define) into this node tree; body_tree is the evaluable form.
The nine node types cover JSON.parse, dry-monads, and the ADR-20 § D3 conditional / membership forms (shipped):
- TypeLeaf — wraps a fully-built
Rigor::Type(use for atoms likenil,Constant<true>,Nominal[Integer]). - Param — reference to a formal parameter declared in the enclosing
Definition#paramslist (e.g.Kinjson::value[K]). The reducer substitutes from the application'sargs. - AppRef — abstract HKT application; the reducer resolves it via the registry, or
returns the
Appcarrier as-is when the reference is self-recursive (lazy "tying-the-knot" handling that lets recursive sums likejson::valuereduce without infinite expansion). - Union — N-ary union of arms.
- NominalApp — parameterised nominal class (
Array[X],Hash[K, V]) whose type args are themselves body nodes.
Every node is a frozen Data.define value; structural equality is by-field.
Defined Under Namespace
Classes: AppRef, Conditional, NominalApp, Param, TestEquality, TestMembership, TestSubtype, TypeLeaf, Union