From 26a1fd0f0861038a76a0f9b09eaef16d808d4139 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 19 Aug 2019 21:52:26 +0200 Subject: Use TypedValue instead of Typed in normalize and typecheck Now Typed is only used in dhall::phase, similarly to Parsed/Resolved/Normalized --- serde_dhall/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'serde_dhall/src') diff --git a/serde_dhall/src/lib.rs b/serde_dhall/src/lib.rs index 48f311e..31643d0 100644 --- a/serde_dhall/src/lib.rs +++ b/serde_dhall/src/lib.rs @@ -127,7 +127,7 @@ pub mod value { use dhall::core::value::TypedValue as TypedThunk; use dhall::core::value::Value as Thunk; use dhall::core::valuef::ValueF as DhallValue; - use dhall::phase::{NormalizedSubExpr, Parsed, Type, Typed}; + use dhall::phase::{NormalizedSubExpr, Parsed, Typed}; use dhall_syntax::Builtin; use super::de::{Error, Result}; @@ -147,7 +147,7 @@ pub mod value { let resolved = Parsed::parse_str(s)?.resolve()?; let typed = match ty { None => resolved.typecheck()?, - Some(t) => resolved.typecheck_with(&t.to_type())?, + Some(t) => resolved.typecheck_with(t.as_typed())?, }; Ok(Value(typed)) } @@ -157,13 +157,13 @@ pub mod value { pub(crate) fn to_value(&self) -> Thunk { self.0.to_value() } - pub(crate) fn to_type(&self) -> Type { - self.0.to_type() + pub(crate) fn as_typed(&self) -> &Typed { + &self.0 } /// Assumes that the given value has type `Type`. pub(crate) fn make_simple_type(v: DhallValue) -> Self { - Value(Typed::from_valuef_and_type(v, Type::const_type())) + Value(Typed::from_valuef_and_type(v, Typed::const_type())) } pub(crate) fn make_builtin_type(b: Builtin) -> Self { Self::make_simple_type(DhallValue::from_builtin(b)) -- cgit v1.2.3