use crate::expr::*; use crate::traits::StaticType; #[allow(unused_imports)] use crate::typecheck::{TypeError, TypeMessage, TypecheckContext}; #[allow(unused_imports)] use dhall_syntax::{Const, ExprF}; use std::borrow::Cow; pub trait DynamicType { fn get_type<'a>(&'a self) -> Result, TypeError>; } impl DynamicType for T { fn get_type<'a>(&'a self) -> Result, TypeError> { Ok(Cow::Owned(T::get_static_type())) } } impl DynamicType for Type { fn get_type(&self) -> Result, TypeError> { self.get_type() } } impl DynamicType for Normalized { fn get_type(&self) -> Result, TypeError> { self.0.get_type() } } impl DynamicType for Typed { fn get_type(&self) -> Result, TypeError> { self.0.get_type() } }