From 56efd2ac39149d8652bd625fbf0679c10823b137 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 6 Apr 2020 22:24:15 +0100 Subject: Move BinOp and Builtin definitions in the relevant module --- dhall/src/operations.rs | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'dhall/src/operations.rs') diff --git a/dhall/src/operations.rs b/dhall/src/operations.rs index 363cd10..1ebf288 100644 --- a/dhall/src/operations.rs +++ b/dhall/src/operations.rs @@ -3,15 +3,46 @@ use std::borrow::Cow; use std::cmp::max; use std::collections::HashMap; +use crate::builtins::Builtin; use crate::error::{ErrorBuilder, TypeError}; use crate::semantics::{ merge_maps, mk_span_err, mkerr, ret_kind, ret_op, ret_ref, Binder, Closure, Hir, HirKind, Nir, NirKind, Ret, TextLit, Tir, TyEnv, Type, }; use crate::syntax::map::DupTreeSet; -use crate::syntax::{ - trivial_result, BinOp, Builtin, Const, ExprKind, Label, NumKind, Span, -}; +use crate::syntax::{trivial_result, Const, ExprKind, Label, NumKind, Span}; + +// 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` + 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, + /// x === y + Equivalence, +} /// Operations #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -- cgit v1.2.3