diff options
author | Nadrieril | 2019-08-19 21:52:26 +0200 |
---|---|---|
committer | Nadrieril | 2019-08-19 21:52:42 +0200 |
commit | 26a1fd0f0861038a76a0f9b09eaef16d808d4139 (patch) | |
tree | e89770d190a73ce5f1bae7798b77c02b598faed2 /serde_dhall | |
parent | 29016b78736dca857e4e7f7c4dc68ed5e30c28bb (diff) |
Use TypedValue instead of Typed in normalize and typecheck
Now Typed is only used in dhall::phase, similarly to
Parsed/Resolved/Normalized
Diffstat (limited to 'serde_dhall')
-rw-r--r-- | serde_dhall/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
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)) |