From 78a0c10a4595683c034b8d3617f55c88cea2aa3c Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 8 Mar 2019 18:17:22 +0100 Subject: Slowly propagate the new type parameter throughout the codebase --- dhall_core/src/context.rs | 4 +- dhall_core/src/core.rs | 269 +++++++++++++++++++++++++++++++--------------- 2 files changed, 186 insertions(+), 87 deletions(-) (limited to 'dhall_core/src') diff --git a/dhall_core/src/context.rs b/dhall_core/src/context.rs index 412d3f0..877843d 100644 --- a/dhall_core/src/context.rs +++ b/dhall_core/src/context.rs @@ -31,8 +31,8 @@ impl Context { /// lookup k n (insert k v c) = lookup k (n - 1) c -- 1 <= n /// lookup k n (insert j v c) = lookup k n c -- k /= j /// ``` - pub fn lookup<'a>(&'a self, k: K, n: usize) -> Option<&'a T> { - self.0.get(&k).and_then(|v| v.get(v.len() - 1 - n)) + pub fn lookup<'a>(&'a self, k: &K, n: usize) -> Option<&'a T> { + self.0.get(k).and_then(|v| v.get(v.len() - 1 - n)) } pub fn map U>(&self, f: F) -> Context { diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index cbf0654..d832a18 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -1,6 +1,7 @@ #![allow(non_snake_case)] use std::collections::BTreeMap; use std::fmt::{self, Display}; +use std::hash::Hash; use std::path::PathBuf; /// Constants for a pure type system @@ -144,12 +145,23 @@ pub enum Expr_ { /// `Var (V x n) ~ x@n` Var(V