#![allow(non_snake_case)] use std::collections::HashSet; use std::fmt; use crate::expr::*; use dhall_core; use dhall_core::context::Context; use dhall_core::*; use dhall_generator as dhall; use self::TypeMessage::*; impl Resolved { pub fn typecheck(self) -> Result> { // let typ = Type(Box::new(Normalized(crate::typecheck::type_of( // self.0.clone(), // )?))); // Ok(Typed(self.0, typ)) let typ = crate::typecheck::type_of(self.0.clone())?; Ok(Typed(self.0, typ)) } } impl Typed { pub fn get_type(&self) -> &Type { &self.1 } } impl Normalized { pub fn get_type(&self) -> &Type { &self.1 } } fn axiom(c: Const) -> Result> { use dhall_core::Const::*; use dhall_core::ExprF::*; match c { Type => Ok(Kind), Kind => Ok(Sort), Sort => Err(TypeError::new(&Context::new(), rc(Const(Sort)), Untyped)), } } fn rule(a: Const, b: Const) -> Result { use dhall_core::Const::*; match (a, b) { (_, Type) => Ok(Type), (Kind, Kind) => Ok(Kind), (Sort, Sort) => Ok(Sort), (Sort, Kind) => Ok(Sort), _ => Err(()), } } fn match_vars(vl: &V