diff options
author | Nadrieril | 2020-02-06 17:58:48 +0000 |
---|---|---|
committer | Nadrieril | 2020-02-09 20:13:23 +0000 |
commit | 5870a46d5ab5810901198f03ed461d5c3bb5aa8a (patch) | |
tree | e1bb2ae195e926a0027144f678ca2eedcfa4e0b0 /dhall/src/lib.rs | |
parent | db1375eccd1e6943b504cd54ed17eb8f4d19c25f (diff) |
Remove move type propagation through Value
Diffstat (limited to 'dhall/src/lib.rs')
-rw-r--r-- | dhall/src/lib.rs | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index d8eeb4a..48d4d96 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -24,7 +24,7 @@ use crate::semantics::resolve; use crate::semantics::resolve::ImportRoot; use crate::semantics::{typecheck, typecheck_with, TyExpr, Value, ValueKind}; use crate::syntax::binary; -use crate::syntax::{Builtin, Const, Expr}; +use crate::syntax::{Builtin, Expr}; pub type ParsedExpr = Expr<Normalized>; pub type DecodedExpr = Expr<Normalized>; @@ -148,18 +148,12 @@ impl Normalized { self.0 } - pub(crate) fn from_const(c: Const) -> Self { - Normalized(Value::from_const(c)) - } - pub(crate) fn from_kind_and_type(v: ValueKind, t: Normalized) -> Self { - Normalized(Value::from_kind_and_type(v, t.into_value())) + pub(crate) fn from_kind(v: ValueKind) -> Self { + Normalized(Value::from_kind(v)) } pub(crate) fn from_value(th: Value) -> Self { Normalized(th) } - pub(crate) fn const_type() -> Self { - Normalized::from_const(Const::Type) - } pub fn make_builtin_type(b: Builtin) -> Self { Normalized::from_value(Value::from_builtin(b)) @@ -177,23 +171,17 @@ impl Normalized { pub fn make_record_type( kts: impl Iterator<Item = (String, Normalized)>, ) -> Self { - Normalized::from_kind_and_type( - ValueKind::RecordType( - kts.map(|(k, t)| (k.into(), t.into_value())).collect(), - ), - Normalized::const_type(), - ) + Normalized::from_kind(ValueKind::RecordType( + kts.map(|(k, t)| (k.into(), t.into_value())).collect(), + )) } pub fn make_union_type( kts: impl Iterator<Item = (String, Option<Normalized>)>, ) -> Self { - Normalized::from_kind_and_type( - ValueKind::UnionType( - kts.map(|(k, t)| (k.into(), t.map(|t| t.into_value()))) - .collect(), - ), - Normalized::const_type(), - ) + Normalized::from_kind(ValueKind::UnionType( + kts.map(|(k, t)| (k.into(), t.map(|t| t.into_value()))) + .collect(), + )) } } |