From 515f6d70cf724d9927f4466ed1cd4300d20b4b09 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Dec 2019 18:14:18 +0000 Subject: Reorganize ast::expr --- dhall/src/syntax/ast/expr.rs | 151 ++++++++++++++++++++++--------------------- 1 file changed, 76 insertions(+), 75 deletions(-) (limited to 'dhall/src/syntax') diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs index 7ac342d..a85b837 100644 --- a/dhall/src/syntax/ast/expr.rs +++ b/dhall/src/syntax/ast/expr.rs @@ -6,46 +6,10 @@ pub type Integer = isize; pub type Natural = usize; pub type Double = NaiveDouble; -pub fn trivial_result(x: Result) -> T { - match x { - Ok(x) => x, - Err(e) => e, - } -} - /// Double with bitwise equality #[derive(Debug, Copy, Clone)] pub struct NaiveDouble(f64); -impl PartialEq for NaiveDouble { - fn eq(&self, other: &Self) -> bool { - self.0.to_bits() == other.0.to_bits() - } -} - -impl Eq for NaiveDouble {} - -impl std::hash::Hash for NaiveDouble { - fn hash(&self, state: &mut H) - where - H: std::hash::Hasher, - { - self.0.to_bits().hash(state) - } -} - -impl From for NaiveDouble { - fn from(x: f64) -> Self { - NaiveDouble(x) - } -} - -impl From for f64 { - fn from(x: NaiveDouble) -> f64 { - x.0 - } -} - /// Constants for a pure type system #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Const { @@ -62,18 +26,6 @@ pub enum Const { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct V