Syntax.Resolved
The typed vocabulary of the prism-resolved-syntax-v1 artifact.
One document per source file: the embedded source identity and every user function’s resolved body as a node-id-carrying tree. Each node’s id is the same identity the prism-tc-facts-v1 table keys on, so a Prism consumer traverses the structure here and joins the checker facts (type, resolution) there by id. The tree is the resolved Core-phase program: references are resolved and the surface sugar forms have been desugared away, so it is a traversable subset of the surface expression vocabulary.
Types
RNode
type RNode = RNode { id: Int, kind: String, span: Span, children: List(RNode) }
One resolved expression node: its NodeId (the join key), its expression-form kind, its byte span, and its immediate children in source order. A leaf carries the empty child list.
RParam
type RParam = RParam { name: String, is_borrow: Bool }
One parameter of a resolved function: the binder its body’s references resolve to, and whether it is borrowed. A pattern parameter’s name is the synthesized binder the resolver assigned, because that is the name the body actually mentions.
RFunction
type RFunction = RFunction { name: String, params: List(RParam), body: RNode }
One user function’s resolved body tree, with its name and parameters.
ResolvedDoc
type ResolvedDoc = ResolvedDoc {
schema: String,
compiler: String,
source: SourceFile,
functions: List(RFunction)
}
A decoded resolved-syntax document: the envelope identity, the embedded source every span indexes into, and the user functions in source order.
Functions and Values
resolved_schema
resolved_schema : () -> String
The schema tag this vocabulary decodes.
rkinds
rkinds : () -> List(String)
The node kinds the artifact spells, one function per form, so a consumer matches on a named kind rather than retyping a bare string at each use site. The list is the artifact’s whole vocabulary: a kind outside it is a document this version does not understand, which rkind_known is how to ask.
rkind_known
rkind_known : (String) -> Bool
Whether a kind string is one this vocabulary names.
rkind_int
rkind_int : () -> String
An integer literal.
rkind_float
rkind_float : () -> String
A float literal.
rkind_char
rkind_char : () -> String
A character literal.
rkind_bool
rkind_bool : () -> String
A boolean literal.
rkind_unit
rkind_unit : () -> String
The unit value.
rkind_str
rkind_str : () -> String
A string literal.
rkind_var
rkind_var : () -> String
A variable reference. Its span covers exactly the identifier, which is what makes references, and only references, addressable in the source.
rkind_hole
rkind_hole : () -> String
A typed hole.
rkind_bin
rkind_bin : () -> String
A binary operator application.
rkind_neg
rkind_neg : () -> String
An arithmetic negation.
rkind_if
rkind_if : () -> String
A conditional.
rkind_let
rkind_let : () -> String
A let binding. Its span starts at the let keyword, so the bound name it introduces is not separately addressable.
rkind_lam
rkind_lam : () -> String
A lambda.
rkind_call
rkind_call : () -> String
A function application.
rkind_pipe
rkind_pipe : () -> String
A pipeline application.
rkind_match
rkind_match : () -> String
A match expression.
rkind_list
rkind_list : () -> String
A list literal.
rkind_tuple
rkind_tuple : () -> String
A tuple literal.
rkind_field
rkind_field : () -> String
A record field access.
rkind_unboxed_tuple
rkind_unboxed_tuple : () -> String
An unboxed tuple literal.
rkind_unboxed_record
rkind_unboxed_record : () -> String
An unboxed record literal.
rkind_unboxed_field
rkind_unboxed_field : () -> String
An unboxed record field access.
rkind_record
rkind_record : () -> String
A record construction.
rkind_record_update
rkind_record_update : () -> String
A record update.
rkind_record_update_path
rkind_record_update_path : () -> String
A nested-path record update.
rkind_handle
rkind_handle : () -> String
An effect handler installation.
rkind_mask
rkind_mask : () -> String
An effect mask.
rkind_inst
rkind_inst : () -> String
An explicit instantiation.
rkind_index
rkind_index : () -> String
An index read.
rkind_index_set
rkind_index_set : () -> String
An index write.
rkind_ann
rkind_ann : () -> String
A type annotation.
rnode_children
rnode_children : (Syntax.Resolved.RNode) -> List(Syntax.Resolved.RNode)
The immediate children of one resolved node, in source order. The one constructor-naming site for RNode traversal; every generic walk derives from it, so a consumer never re-matches the node shape.
rnode_rebuild
rnode_rebuild : (Syntax.Resolved.RNode, List(Syntax.Resolved.RNode)) -> Syntax.Resolved.RNode
Put a replacement child list back into a resolved node, keeping its id, kind, and span. Fails closed: a list of the wrong length yields the node unchanged.
rnode_layer
rnode_layer : () -> Control.Layer.Layer(Syntax.Resolved.RNode)
The children-and-rebuild pair for resolved nodes, so every strategy in Control.Rewrite and every query in Control.Layer works on a resolved body.
rnode_universe
rnode_universe : (Syntax.Resolved.RNode) -> List(Syntax.Resolved.RNode)
Every node of a resolved body, root first, depth-first. The uniplate universe over RNode, the traversal a Prism-written checker walks a body with.
rnode_count
rnode_count : (Syntax.Resolved.RNode) -> Int
The number of nodes in a resolved body.
rnode_count(RNode { id = 0, kind = "unit", span = Span { lo = 0, hi = 0 }, children = [] })
1