From 705433487da3cd3b4517fcf74b0497c76dbb4080 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 6 Aug 2019 22:36:43 +0200 Subject: Prepare for https://github.com/dhall-lang/dhall-lang/pull/630 --- dhall/src/core/value.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'dhall/src/core') diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs index bc8fa34..f47f1b2 100644 --- a/dhall/src/core/value.rs +++ b/dhall/src/core/value.rs @@ -47,6 +47,7 @@ pub enum Value { DoubleLit(NaiveDouble), EmptyOptionalLit(TypeThunk), NEOptionalLit(Thunk), + // EmptyListLit(t) means `[] : List t` EmptyListLit(TypeThunk), NEListLit(Vec), RecordLit(HashMap), @@ -128,9 +129,10 @@ impl Value { Value::NEOptionalLit(n) => { rc(ExprF::SomeLit(n.normalize_to_expr_maybe_alpha(alpha))) } - Value::EmptyListLit(n) => { - rc(ExprF::EmptyListLit(n.normalize_to_expr_maybe_alpha(alpha))) - } + Value::EmptyListLit(n) => rc(ExprF::EmptyListLit(rc(ExprF::App( + rc(ExprF::Builtin(Builtin::List)), + n.normalize_to_expr_maybe_alpha(alpha), + )))), Value::NEListLit(elts) => rc(ExprF::NEListLit( elts.iter() .map(|n| n.normalize_to_expr_maybe_alpha(alpha)) -- cgit v1.2.3 From d248762095908246951b6aa6c211587c6e333c0e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 7 Aug 2019 21:05:01 +0200 Subject: Remove union literals from the language --- dhall/src/core/value.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'dhall/src/core') diff --git a/dhall/src/core/value.rs b/dhall/src/core/value.rs index f47f1b2..d7b9149 100644 --- a/dhall/src/core/value.rs +++ b/dhall/src/core/value.rs @@ -178,19 +178,10 @@ impl Value { .collect(); rc(ExprF::Field(rc(ExprF::UnionType(kts)), l.clone())) } - Value::UnionLit(l, v, kts) => rc(ExprF::UnionLit( - l.clone(), + Value::UnionLit(l, v, kts) => rc(ExprF::App( + Value::UnionConstructor(l.clone(), kts.clone()) + .normalize_to_expr_maybe_alpha(alpha), v.normalize_to_expr_maybe_alpha(alpha), - kts.iter() - .map(|(k, v)| { - ( - k.clone(), - v.as_ref().map(|v| { - v.normalize_to_expr_maybe_alpha(alpha) - }), - ) - }) - .collect(), )), Value::TextLit(elts) => { use InterpolatedTextContents::{Expr, Text}; -- cgit v1.2.3