summaryrefslogtreecommitdiff
path: root/dhall/src/expr.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-16 18:03:12 +0200
committerNadrieril2019-04-16 18:04:09 +0200
commitba26169d47d42a8f50d30f29f699edb61a4b3759 (patch)
treec355bef52d92dfa4fb57b9d608bb2fc8073a999b /dhall/src/expr.rs
parent0d3b31ab8e2f0b9977ef718bb2256de37e714d3a (diff)
Remove higher-kinded type noise in Type
Diffstat (limited to '')
-rw-r--r--dhall/src/expr.rs9
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)),
+ })
}
}