pub enum DhallExpr {
Show 36 variants
BoolLit(bool),
NaturalLit(u64),
IntegerLit(i64),
DoubleLit(f64),
TextLit(String),
TextInterp(String, Box<DhallExpr>, String),
ListLit(Vec<DhallExpr>),
EmptyList(DhallType),
Some(Box<DhallExpr>),
None(DhallType),
RecordLit(Box<DhallRecord>),
RecordType(Vec<(String, DhallType)>),
UnionLit {
union_type: DhallType,
ctor: String,
value: Option<Box<DhallExpr>>,
},
Lambda(Box<DhallFunction>),
Forall(String, DhallType, Box<DhallExpr>),
Let(Vec<DhallDecl>, Box<DhallExpr>),
If(Box<DhallExpr>, Box<DhallExpr>, Box<DhallExpr>),
Merge(Box<DhallExpr>, Box<DhallExpr>, Option<DhallType>),
ToMap(Box<DhallExpr>, Option<DhallType>),
Assert(Box<DhallExpr>, Box<DhallExpr>),
Equivalent(Box<DhallExpr>, Box<DhallExpr>),
With(Box<DhallExpr>, Vec<(String, DhallExpr)>),
Select(Box<DhallExpr>, String),
Project(Box<DhallExpr>, Vec<String>),
Application(Box<DhallExpr>, Box<DhallExpr>),
Var(String),
Import(DhallImport),
Annot(Box<DhallExpr>, DhallType),
BoolOp(String, Box<DhallExpr>, Box<DhallExpr>),
NaturalOp(String, Box<DhallExpr>, Box<DhallExpr>),
TextAppend(Box<DhallExpr>, Box<DhallExpr>),
ListAppend(Box<DhallExpr>, Box<DhallExpr>),
RecordTypeMerge(Box<DhallExpr>, Box<DhallExpr>),
RecordMerge(Box<DhallExpr>, Box<DhallExpr>),
Universe(DhallType),
BuiltinType(DhallType),
}Expand description
Dhall expression AST.
Variants§
BoolLit(bool)
Boolean literal: True / False
NaturalLit(u64)
Natural number literal: 0, 42
IntegerLit(i64)
Integer literal: +1, -5
DoubleLit(f64)
Double literal: 3.14
TextLit(String)
Text literal: "hello, world"
TextInterp(String, Box<DhallExpr>, String)
Text interpolation: "prefix ${expr} suffix"
ListLit(Vec<DhallExpr>)
List literal: [ v1, v2, v3 ]
EmptyList(DhallType)
Typed empty list: [] : List Natural
Some(Box<DhallExpr>)
Some value (Optional constructor)
None(DhallType)
None T (empty Optional)
RecordLit(Box<DhallRecord>)
Record value: { field1 = v1, field2 = v2 }
RecordType(Vec<(String, DhallType)>)
Record type: { field1 : T1, field2 : T2 }
UnionLit
Union value: < Ctor : T | ... >.Ctor value
Fields
Lambda(Box<DhallFunction>)
Lambda: \(x : T) -> body
Forall(String, DhallType, Box<DhallExpr>)
Dependent forall: forall (x : T) -> body
Let(Vec<DhallDecl>, Box<DhallExpr>)
Let binding: let x : T = e in body
If(Box<DhallExpr>, Box<DhallExpr>, Box<DhallExpr>)
If-then-else: if cond then t else f
Merge(Box<DhallExpr>, Box<DhallExpr>, Option<DhallType>)
merge handler union : T — union elimination
ToMap(Box<DhallExpr>, Option<DhallType>)
toMap record : List { mapKey : Text, mapValue : T }
Assert(Box<DhallExpr>, Box<DhallExpr>)
Equivalence assertion: assert : a === b
Equivalent(Box<DhallExpr>, Box<DhallExpr>)
Equivalence type: a === b
With(Box<DhallExpr>, Vec<(String, DhallExpr)>)
Record update: record // { field = value }
Select(Box<DhallExpr>, String)
Field selection: record.field
Project(Box<DhallExpr>, Vec<String>)
Projection: record.{ field1, field2 }
Application(Box<DhallExpr>, Box<DhallExpr>)
Function application: f x
Var(String)
Variable: x, Natural/show, List/map
Import(DhallImport)
Import expression
Annot(Box<DhallExpr>, DhallType)
Type ascription: x : T
BoolOp(String, Box<DhallExpr>, Box<DhallExpr>)
Boolean operators: &&, ||
NaturalOp(String, Box<DhallExpr>, Box<DhallExpr>)
Natural/Integer arithmetic: +, *
TextAppend(Box<DhallExpr>, Box<DhallExpr>)
Text append: x ++ y
ListAppend(Box<DhallExpr>, Box<DhallExpr>)
List append: xs # ys
RecordTypeMerge(Box<DhallExpr>, Box<DhallExpr>)
Record merge (types): T1 /\ T2
RecordMerge(Box<DhallExpr>, Box<DhallExpr>)
Record value merge: r1 // r2
Universe(DhallType)
Type, Kind, Sort
BuiltinType(DhallType)
Bool, Natural, Integer, Double, Text as type expressions