From f88880004c7dcf5e67c4d5e2330e6e879523f27b Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 29 Jan 2020 18:30:12 +0000 Subject: Use Normalized in serde_dhall --- serde_dhall/src/lib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'serde_dhall') diff --git a/serde_dhall/src/lib.rs b/serde_dhall/src/lib.rs index d65ee7d..334eed9 100644 --- a/serde_dhall/src/lib.rs +++ b/serde_dhall/src/lib.rs @@ -181,14 +181,14 @@ pub use value::Value; // A Dhall value. #[doc(hidden)] pub mod value { - use dhall::semantics::phase::{NormalizedExpr, Parsed, Typed}; + use dhall::semantics::phase::{Normalized, NormalizedExpr, Parsed}; use dhall::syntax::Builtin; use super::de::{Error, Result}; /// A Dhall value #[derive(Debug, Clone, PartialEq, Eq)] - pub struct Value(Typed); + pub struct Value(Normalized); impl Value { pub fn from_str(s: &str, ty: Option<&Value>) -> Result { @@ -201,38 +201,38 @@ pub mod value { let resolved = Parsed::parse_str(s)?.resolve()?; let typed = match ty { None => resolved.typecheck()?, - Some(t) => resolved.typecheck_with(t.as_typed())?, + Some(t) => resolved.typecheck_with(t.as_normalized())?, }; - Ok(Value(typed)) + Ok(Value(typed.normalize())) } pub(crate) fn to_expr(&self) -> NormalizedExpr { - self.0.normalize_to_expr() + self.0.to_expr() } - pub(crate) fn as_typed(&self) -> &Typed { + pub(crate) fn as_normalized(&self) -> &Normalized { &self.0 } pub(crate) fn make_builtin_type(b: Builtin) -> Self { - Value(Typed::make_builtin_type(b)) + Value(Normalized::make_builtin_type(b)) } pub(crate) fn make_optional_type(t: Value) -> Self { - Value(Typed::make_optional_type(t.0)) + Value(Normalized::make_optional_type(t.0)) } pub(crate) fn make_list_type(t: Value) -> Self { - Value(Typed::make_list_type(t.0)) + Value(Normalized::make_list_type(t.0)) } // Made public for the StaticType derive macro #[doc(hidden)] pub fn make_record_type( kts: impl Iterator, ) -> Self { - Value(Typed::make_record_type(kts.map(|(k, t)| (k, t.0)))) + Value(Normalized::make_record_type(kts.map(|(k, t)| (k, t.0)))) } #[doc(hidden)] pub fn make_union_type( kts: impl Iterator)>, ) -> Self { - Value(Typed::make_union_type( + Value(Normalized::make_union_type( kts.map(|(k, t)| (k, t.map(|t| t.0))), )) } -- cgit v1.2.3