Surface
Surface specifications define constructor tags and handlers. HOAS
elaboration consults the attached registry only for nodes that carry
_surfaceRegistry, so existing HOAS terms continue through the built-in
dispatcher.
collectImplicitMetas
Collect surface-created implicit metavariable terms from an elaborated overlay term.
ElabTm -> [SurfaceMeta]collectSurfaceMetas
Collect explicitly marked overlay metavariable terms from an elaborated surface result.
ElabTm -> [SurfaceMeta]containsImplicitMeta
Predicate for unresolved surface-created implicit metavariable terms.
ElabTm -> BoolcontainsSurfaceMeta
Predicate for any overlay metavariable term inside an elaborated surface result.
ElabTm -> BooldefineOrnament
Package a surface-to-target mapping with section and forget morphisms for elaborator derivation.
{ source, target, mapping?, section?, forget? } -> SurfaceOrnamentdefineSurface
Define a named surface language with constructor metadata and elaboration handlers.
{ name, description?, scope?, constructors } -> SurfaceSpecderiveElaborator
Derive an elaborator entry point from a surface specification and optional ornament section. Expected type and source position are threaded into surface handlers.
{ surface, ornament? } -> { registry, elaborate }deriveParser
Derive a parser shell for a surface specification.
{ surface, parse? } -> { parse }derivePrinter
Derive a small printer for surface AST nodes.
{ surface, render? } -> { print }elaborate
Elaborate one surface term, optionally checking it against an expected HOAS type and source position.
{ surface, term, expectedType?, position?, ornament? } -> Tm | ErrorfinalizeSurfaceElab
Return a structured unsolved-implicit error when elaboration leaves surface implicit metas unresolved.
{ result, state?, term?, surface?, position? } -> ElabTm | Errorframework
Convenience bundle for the surface-language definition, ornament, elaboration, parser, and printer APIs.
handlerContext
Build the argument record passed to surface elaboration handlers, adding expected type, source position, and implicit-meta helpers.
{ h, depth, lower, hoas, fx, ... } -> HandlerArgsimplicitMeta
Allocate an implicit metavariable using the Phase 6 meta-context shape and return both overlay value and term forms.
{ type?, state?, position?, surface?, label? } -> { id, value, term, state }parse
Parse one input value with a derived parser shell or supplied parser.
{ surface, input, parse? } -> Hoasprelude
Minimal surface prelude with List and an implicit-argument nil proof fixture.
print
Print one surface AST node with a derived or supplied renderer.
{ surface, term, render? } -> StringsurfaceTerm
Construct one term from a surface specification.
SurfaceSpec -> String -> Attrs -> Hoastoy
Toy boolean surface used as an end-to-end elaboration fixture.
unsolvedImplicitError
Build the structured surface error for unresolved implicit metavariables.
{ metas, term?, surface?, position? } -> ErrorwithSurfaceContext
Attach root expected-type and position metadata to a surface AST node before elaboration.
{ term, expectedType?, position? } -> HoasSub-namespaces
Source
src/tc/surface/define-ornament.nixsrc/tc/surface/define-surface.nixsrc/tc/surface/derive-elaborator.nixsrc/tc/surface/derive-parser.nixsrc/tc/surface/derive-printer.nixsrc/tc/surface/framework.nixsrc/tc/surface/handler-context.nixsrc/tc/surface/implicit.nixsrc/tc/surface/prelude.nixsrc/tc/surface/registry.nix