From 32051979778436ea02cb406551f126fe22ea1636 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Thu, 9 May 2019 16:53:48 +0200 Subject: ExprF need not be generic in Label --- dhall/src/phase/normalize.rs | 9 ++++----- dhall/src/phase/typecheck.rs | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'dhall/src/phase') diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs index 52c1666..64de2a7 100644 --- a/dhall/src/phase/normalize.rs +++ b/dhall/src/phase/normalize.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use dhall_syntax::{ - BinOp, Builtin, ExprF, InterpolatedText, InterpolatedTextContents, Label, + BinOp, Builtin, ExprF, InterpolatedText, InterpolatedTextContents, NaiveDouble, X, }; @@ -356,12 +356,11 @@ pub(crate) fn normalize_whnf( } // Thunk subexpressions - let expr: ExprF = + let expr: ExprF = expr.as_ref().map_ref_with_special_handling_of_binders( |e| Thunk::new(ctx.clone(), e.clone()), |x, e| Thunk::new(ctx.skip(x), e.clone()), |_| unreachable!(), - Label::clone, ); normalize_one_layer(expr) @@ -372,7 +371,7 @@ enum Ret<'a> { RetValue(Value), RetThunk(Thunk), RetThunkRef(&'a Thunk), - RetExpr(ExprF), + RetExpr(ExprF), } fn merge_maps( @@ -521,7 +520,7 @@ fn apply_binop<'a>(o: BinOp, x: &'a Thunk, y: &'a Thunk) -> Option> { }) } -pub(crate) fn normalize_one_layer(expr: ExprF) -> Value { +pub(crate) fn normalize_one_layer(expr: ExprF) -> Value { use Ret::{RetExpr, RetThunk, RetThunkRef, RetValue}; use Value::{ BoolLit, DoubleLit, EmptyListLit, EmptyOptionalLit, IntegerLit, Lam, diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs index 497a703..2dc97bb 100644 --- a/dhall/src/phase/typecheck.rs +++ b/dhall/src/phase/typecheck.rs @@ -421,7 +421,6 @@ fn type_with( |e| type_with(ctx, e.clone()), |_, _| unreachable!(), |_| unreachable!(), - |l| Ok(Label::clone(l)), )?; let ret = type_last_layer(ctx, &expr)?; let ret = match ret { @@ -449,7 +448,7 @@ fn type_with( /// layer. fn type_last_layer( ctx: &TypecheckContext, - e: &ExprF, + e: &ExprF, ) -> Result { use crate::error::TypeMessage::*; use dhall_syntax::BinOp::*; -- cgit v1.2.3