diff options
author | Nadrieril | 2019-04-16 18:03:12 +0200 |
---|---|---|
committer | Nadrieril | 2019-04-16 18:04:09 +0200 |
commit | ba26169d47d42a8f50d30f29f699edb61a4b3759 (patch) | |
tree | c355bef52d92dfa4fb57b9d608bb2fc8073a999b /dhall/src/expr.rs | |
parent | 0d3b31ab8e2f0b9977ef718bb2256de37e714d3a (diff) |
Remove higher-kinded type noise in Type
Diffstat (limited to 'dhall/src/expr.rs')
-rw-r--r-- | dhall/src/expr.rs | 9 |
1 files changed, 8 insertions, 1 deletions
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<Normalized<'a>>), + Const(dhall_core::Const), /// The type of `Sort` SuperType, } @@ -116,8 +117,14 @@ impl<'a> Normalized<'a> { pub(crate) fn as_expr(&self) -> &SubExpr<X, X> { &self.0 } + pub(crate) fn into_expr(self) -> SubExpr<X, X> { + 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)), + }) } } |