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<'a> DynamicType for Type<'a> { fn get_type(&self) -> Result>, TypeError> { self.get_type() } } impl<'a> DynamicType for Normalized<'a> { fn get_type(&self) -> Result>, TypeError> { self.0.get_type() } } impl<'a> DynamicType for Typed<'a> { fn get_type(&self) -> Result>, TypeError> { self.0.get_type() } }