From ba26169d47d42a8f50d30f29f699edb61a4b3759 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 16 Apr 2019 18:03:12 +0200 Subject: Remove higher-kinded type noise in Type --- dhall/src/expr.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'dhall/src/expr.rs') diff --git a/dhall/src/expr.rs b/dhall/src/expr.rs index cda1d8d..9e89e3a 100644 --- a/dhall/src/expr.rs +++ b/dhall/src/expr.rs @@ -73,6 +73,7 @@ pub struct Type<'a>(pub(crate) TypeInternal<'a>); #[derive(Debug, Clone, PartialEq, Eq)] pub(crate) enum TypeInternal<'a> { Expr(Box>), + Const(dhall_core::Const), /// The type of `Sort` SuperType, } @@ -116,8 +117,14 @@ impl<'a> Normalized<'a> { pub(crate) fn as_expr(&self) -> &SubExpr { &self.0 } + pub(crate) fn into_expr(self) -> SubExpr { + self.0 + } pub(crate) fn into_type(self) -> Type<'a> { - crate::expr::Type(TypeInternal::Expr(Box::new(self))) + Type(match self.0.as_ref() { + ExprF::Const(c) => TypeInternal::Const(*c), + _ => TypeInternal::Expr(Box::new(self)), + }) } } -- cgit v1.2.3