Add boolean operators in the AST
@@ -421,6 +421,15 @@ pub enum UnaryOp<CapturedTerm> {
/// Test if a term is a record.
IsRecord(),
+ // Boolean AND and OR operator are encoded as unary operators so that they can be lazy in their
+ // second argument.
+ /// Boolean AND operator.
+ BoolAnd(),
+ /// Boolean OR operator.
+ BoolOr(),
+ /// Boolean NOT operator.
+ BoolNot(),
+
/// Raise a blame, which stops the execution and prints an error according to the label argument.
Blame(),
@@ -534,6 +543,10 @@ impl<Ty> UnaryOp<Ty> {
IsList() => IsList(),
IsRecord() => IsRecord(),
+ BoolAnd() => BoolAnd(),
+ BoolOr() => BoolOr(),
+ BoolNot() => BoolNot(),
+
Blame() => Blame(),
Embed(id) => Embed(id),
