summaryrefslogtreecommitdiff
path: root/dhall/src/traits/dynamic_type.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/traits/dynamic_type.rs
parent0d3b31ab8e2f0b9977ef718bb2256de37e714d3a (diff)
Remove higher-kinded type noise in Type
Diffstat (limited to 'dhall/src/traits/dynamic_type.rs')
-rw-r--r--dhall/src/traits/dynamic_type.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/dhall/src/traits/dynamic_type.rs b/dhall/src/traits/dynamic_type.rs
index 28ed76d..d2a5414 100644
--- a/dhall/src/traits/dynamic_type.rs
+++ b/dhall/src/traits/dynamic_type.rs
@@ -1,6 +1,6 @@
use crate::expr::*;
use crate::traits::StaticType;
-use crate::typecheck::{TypeError, TypeMessage};
+use crate::typecheck::{type_of_const, TypeError, TypeMessage};
use dhall_core::context::Context;
use dhall_core::{Const, ExprF};
use std::borrow::Cow;
@@ -17,10 +17,10 @@ impl<T: StaticType> DynamicType for T {
impl<'a> DynamicType for Type<'a> {
fn get_type(&self) -> Result<Cow<'_, Type<'static>>, TypeError> {
- use TypeInternal::*;
match &self.0 {
- Expr(e) => e.get_type(),
- SuperType => Err(TypeError::new(
+ TypeInternal::Expr(e) => e.get_type(),
+ TypeInternal::Const(c) => Ok(Cow::Owned(type_of_const(*c))),
+ TypeInternal::SuperType => Err(TypeError::new(
&Context::new(),
dhall_core::rc(ExprF::Const(Const::Sort)),
TypeMessage::Untyped,