use std::collections::BTreeSet; use crate::syntax::{trivial_result, Label}; // Definition order must match precedence order for // pretty-printing to work correctly #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum BinOp { /// x === y Equivalence, /// `x ? y` ImportAlt, /// `x || y` BoolOr, /// `x + y` NaturalPlus, /// `x ++ y` TextAppend, /// `x # y` ListAppend, /// `x && y` BoolAnd, /// `x ∧ y` RecursiveRecordMerge, /// `x ⫽ y` RightBiasedRecordMerge, /// `x ⩓ y` RecursiveRecordTypeMerge, /// `x * y` NaturalTimes, /// `x == y` BoolEQ, /// `x != y` BoolNE, } /// Operations #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum OpKind { /// `f a` App(SubExpr, SubExpr), /// Binary operations BinOp(BinOp, SubExpr, SubExpr), /// `if x then y else z` BoolIf(SubExpr, SubExpr, SubExpr), /// `merge x y : t` Merge(SubExpr, SubExpr, Option), /// `toMap x : t` ToMap(SubExpr, Option), /// `e.x` Field(SubExpr, Label), /// `e.{ x, y, z }` Projection(SubExpr, BTreeSet