#[non_exhaustive]pub enum Type {
Con {
qualifier: Option<ModuleName>,
name: Identifier,
span: Span,
},
App(Box<Self>, Vec<Self>, Span),
List(Box<Self>, Span),
Tuple(Vec<Self>, Span),
Fun(Box<Self>, Box<Self>, Span),
Var(Identifier, Span),
Unit(Span),
Constrained(Box<Self>, Span),
Lit {
kind: LitKind,
text: String,
span: Span,
},
}Expand description
Structured Daml type, parsed from the real token stream.
Scoped to the forms the corpus actually contains; it exists so consumers can
tell a type application from a function arrow from an
atomic constructor — a distinction a string matcher structurally cannot make.
Every node carries a byte span so consumers can render exact source text from
(source, span). Unlike declarations, expressions, and patterns, type nodes
do not carry a separate Pos; use Type::span and source line mapping
when a line/column anchor is required for a type fragment.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Con
Type constructor, possibly qualified: Party, DA.Map.Map.
Fields
qualifier: Option<ModuleName>Optional module qualifier before the constructor name.
name: IdentifierConstructor name.
App(Box<Self>, Vec<Self>, Span)
Type application, head applied to one or more args: ContractId Foo,
Map Text Int, Script (). Type-level nat literals (the 10 in
Numeric 10) are NOT types, so they are dropped from the arg list — a
Numeric 10 collapses to the bare head Con "Numeric".
List(Box<Self>, Span)
List type [T].
Tuple(Vec<Self>, Span)
Tuple type (a, b, ...).
Fun(Box<Self>, Box<Self>, Span)
Function type a -> b (right-associative).
Var(Identifier, Span)
Lowercase type variable: a, n.
Unit(Span)
The unit type ().
Constrained(Box<Self>, Span)
A constrained type C a => T: the context is not modeled, the body T
is kept.
Lit
Type-level string or char literal, e.g. the "observers" in
HasField "observers" t PartiesMap.