diff options
author | Nadrieril | 2019-08-19 23:00:49 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-19 23:00:49 +0200 |
commit | 730f2ebb146792994c7492b6c05f7d09d42cbccf (patch) | |
tree | 9685812388937fdd6c51165804fddf7a1bbf5e6a /serde_dhall | |
parent | 07a276c1d6ee892b93abbd7a73c78c96d56f4fe7 (diff) |
Merge TypedValue and Value
Diffstat (limited to 'serde_dhall')
-rw-r--r-- | serde_dhall/src/lib.rs | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/serde_dhall/src/lib.rs b/serde_dhall/src/lib.rs index 9d2ec85..cef11dd 100644 --- a/serde_dhall/src/lib.rs +++ b/serde_dhall/src/lib.rs @@ -124,9 +124,8 @@ pub use value::Value; // A Dhall value. 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::core::value::Value as DhallValue; + use dhall::core::valuef::ValueF as DhallValueF; use dhall::phase::{NormalizedSubExpr, Parsed, Typed}; use dhall_syntax::Builtin; @@ -154,7 +153,7 @@ pub mod value { pub(crate) fn to_expr(&self) -> NormalizedSubExpr { self.0.to_expr() } - pub(crate) fn to_value(&self) -> Thunk { + pub(crate) fn to_value(&self) -> DhallValue { self.0.to_value() } pub(crate) fn as_typed(&self) -> &Typed { @@ -162,21 +161,22 @@ pub mod value { } /// Assumes that the given value has type `Type`. - pub(crate) fn make_simple_type(v: DhallValue) -> Self { + pub(crate) fn make_simple_type(v: DhallValueF) -> Self { 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)) + Self::make_simple_type(DhallValueF::from_builtin(b)) } pub(crate) fn make_optional_type(t: Value) -> Self { Self::make_simple_type( - DhallValue::from_builtin(Builtin::Optional) + DhallValueF::from_builtin(Builtin::Optional) .app_value(t.to_value()), ) } pub(crate) fn make_list_type(t: Value) -> Self { Self::make_simple_type( - DhallValue::from_builtin(Builtin::List).app_value(t.to_value()), + DhallValueF::from_builtin(Builtin::List) + .app_value(t.to_value()), ) } // Made public for the StaticType derive macro @@ -184,22 +184,17 @@ pub mod value { pub fn make_record_type( kts: impl Iterator<Item = (String, Value)>, ) -> Self { - Self::make_simple_type(DhallValue::RecordType( - kts.map(|(k, t)| { - (k.into(), TypedThunk::from_value(t.to_value())) - }) - .collect(), + Self::make_simple_type(DhallValueF::RecordType( + kts.map(|(k, t)| (k.into(), t.to_value())).collect(), )) } #[doc(hidden)] pub fn make_union_type( kts: impl Iterator<Item = (String, Option<Value>)>, ) -> Self { - Self::make_simple_type(DhallValue::UnionType( - kts.map(|(k, t)| { - (k.into(), t.map(|t| TypedThunk::from_value(t.to_value()))) - }) - .collect(), + Self::make_simple_type(DhallValueF::UnionType( + kts.map(|(k, t)| (k.into(), t.map(|t| t.to_value()))) + .collect(), )) } } |