#![allow(non_snake_case)] use std::collections::BTreeMap; use std::rc::Rc; use dhall_proc_macros as dhall; use dhall_syntax::context::Context; use dhall_syntax::{ rc, BinOp, Builtin, Const, ExprF, Integer, InterpolatedTextContents, Label, Natural, Span, SubExpr, V, X, }; use crate::expr::{Normalized, Type, Typed}; type InputSubExpr = SubExpr; type OutputSubExpr = SubExpr; impl Typed { /// Reduce an expression to its normal form, performing beta reduction /// /// `normalize` does not type-check the expression. You may want to type-check /// expressions before normalizing them since normalization can convert an /// ill-typed expression into a well-typed expression. /// /// However, `normalize` will not fail if the expression is ill-typed and will /// leave ill-typed sub-expressions unevaluated. /// pub fn normalize(self) -> Normalized { match &self { Typed::Sort => {} Typed::Value(thunk, _) => { thunk.normalize_nf(); } } Normalized(self) } } /// Stores a pair of variables: a normal one and if relevant one /// that corresponds to the alpha-normalized version of the first one. #[derive(Debug, Clone, Eq)] pub(crate) struct AlphaVar { normal: V