summaryrefslogtreecommitdiff
path: root/dhall/src/phase
diff options
context:
space:
mode:
Diffstat (limited to 'dhall/src/phase')
-rw-r--r--dhall/src/phase/binary.rs16
-rw-r--r--dhall/src/phase/mod.rs2
-rw-r--r--dhall/src/phase/normalize.rs10
-rw-r--r--dhall/src/phase/parse.rs2
-rw-r--r--dhall/src/phase/resolve.rs8
-rw-r--r--dhall/src/phase/typecheck.rs24
6 files changed, 31 insertions, 31 deletions
diff --git a/dhall/src/phase/binary.rs b/dhall/src/phase/binary.rs
index 0639120..b1e7638 100644
--- a/dhall/src/phase/binary.rs
+++ b/dhall/src/phase/binary.rs
@@ -3,8 +3,8 @@ use serde_cbor::value::value as cbor;
use std::iter::FromIterator;
use std::vec;
-use dhall_syntax::map::DupTreeMap;
-use dhall_syntax::{
+use crate::syntax::map::DupTreeMap;
+use crate::syntax::{
Expr, ExprF, FilePath, FilePrefix, Hash, Import, ImportLocation,
ImportMode, Integer, InterpolatedText, Label, Natural, RawExpr, Scheme,
Span, URL, V,
@@ -32,7 +32,7 @@ pub fn rc<E>(x: RawExpr<E>) -> Expr<E> {
fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
use cbor::Value::*;
- use dhall_syntax::{BinOp, Builtin, Const};
+ use crate::syntax::{BinOp, Builtin, Const};
use ExprF::*;
Ok(rc(match data {
String(s) => match Builtin::parse(s) {
@@ -350,7 +350,7 @@ fn cbor_value_to_dhall(data: &cbor::Value) -> Result<DecodedExpr, DecodeError> {
"import/type".to_owned(),
))?,
};
- Import(dhall_syntax::Import {
+ Import(crate::syntax::Import {
mode,
hash,
location,
@@ -473,8 +473,8 @@ where
S: serde::ser::Serializer,
{
use cbor::Value::{String, I64, U64};
- use dhall_syntax::Builtin;
- use dhall_syntax::ExprF::*;
+ use crate::syntax::Builtin;
+ use crate::syntax::ExprF::*;
use std::iter::once;
use self::Serialize::{RecordMap, UnionMap};
@@ -548,7 +548,7 @@ where
once(tag(4)).chain(once(null())).chain(xs.iter().map(expr)),
),
TextLit(xs) => {
- use dhall_syntax::InterpolatedTextContents::{Expr, Text};
+ use crate::syntax::InterpolatedTextContents::{Expr, Text};
ser.collect_seq(once(tag(18)).chain(xs.iter().map(|x| match x {
Expr(x) => expr(x),
Text(x) => cbor(String(x.clone())),
@@ -559,7 +559,7 @@ where
UnionType(map) => ser_seq!(ser; tag(11), UnionMap(map)),
Field(x, l) => ser_seq!(ser; tag(9), expr(x), label(l)),
BinOp(op, x, y) => {
- use dhall_syntax::BinOp::*;
+ use crate::syntax::BinOp::*;
let op = match op {
BoolOr => 0,
BoolAnd => 1,
diff --git a/dhall/src/phase/mod.rs b/dhall/src/phase/mod.rs
index 337ce3d..918c4d0 100644
--- a/dhall/src/phase/mod.rs
+++ b/dhall/src/phase/mod.rs
@@ -1,7 +1,7 @@
use std::fmt::Display;
use std::path::Path;
-use dhall_syntax::{Builtin, Const, Expr};
+use crate::syntax::{Builtin, Const, Expr};
use crate::core::value::{ToExprOptions, Value};
use crate::core::valuef::ValueF;
diff --git a/dhall/src/phase/normalize.rs b/dhall/src/phase/normalize.rs
index b712027..3ed53f4 100644
--- a/dhall/src/phase/normalize.rs
+++ b/dhall/src/phase/normalize.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
-use dhall_syntax::Const::Type;
-use dhall_syntax::{
+use crate::syntax::Const::Type;
+use crate::syntax::{
BinOp, Builtin, ExprF, InterpolatedText, InterpolatedTextContents, Label,
NaiveDouble,
};
@@ -47,7 +47,7 @@ macro_rules! make_closure {
}};
(1 + $($rest:tt)*) => {
ValueF::PartialExpr(ExprF::BinOp(
- dhall_syntax::BinOp::NaturalPlus,
+ crate::syntax::BinOp::NaturalPlus,
make_closure!($($rest)*),
Value::from_valuef_and_type(
ValueF::NaturalLit(1),
@@ -62,7 +62,7 @@ macro_rules! make_closure {
let tail = make_closure!($($tail)*);
let list_type = tail.get_type_not_sort();
ValueF::PartialExpr(ExprF::BinOp(
- dhall_syntax::BinOp::ListAppend,
+ crate::syntax::BinOp::ListAppend,
ValueF::NEListLit(vec![head])
.into_value_with_type(list_type.clone()),
tail,
@@ -76,7 +76,7 @@ pub(crate) fn apply_builtin(
args: Vec<Value>,
ty: &Value,
) -> ValueF {
- use dhall_syntax::Builtin::*;
+ use crate::syntax::Builtin::*;
use ValueF::*;
// Small helper enum
diff --git a/dhall/src/phase/parse.rs b/dhall/src/phase/parse.rs
index 540ceea..e277e54 100644
--- a/dhall/src/phase/parse.rs
+++ b/dhall/src/phase/parse.rs
@@ -2,7 +2,7 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;
-use dhall_syntax::parse_expr;
+use crate::syntax::parse_expr;
use crate::error::Error;
use crate::phase::resolve::ImportRoot;
diff --git a/dhall/src/phase/resolve.rs b/dhall/src/phase/resolve.rs
index c302bfa..5920f82 100644
--- a/dhall/src/phase/resolve.rs
+++ b/dhall/src/phase/resolve.rs
@@ -3,9 +3,9 @@ use std::path::{Path, PathBuf};
use crate::error::{Error, ImportError};
use crate::phase::{Normalized, NormalizedExpr, Parsed, Resolved};
-use dhall_syntax::{FilePath, ImportLocation, URL};
+use crate::syntax::{FilePath, ImportLocation, URL};
-type Import = dhall_syntax::Import<NormalizedExpr>;
+type Import = crate::syntax::Import<NormalizedExpr>;
/// A root from which to resolve relative imports.
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -24,8 +24,8 @@ fn resolve_import(
import_stack: &ImportStack,
) -> Result<Normalized, ImportError> {
use self::ImportRoot::*;
- use dhall_syntax::FilePrefix::*;
- use dhall_syntax::ImportLocation::*;
+ use crate::syntax::FilePrefix::*;
+ use crate::syntax::ImportLocation::*;
let cwd = match root {
LocalDir(cwd) => cwd,
};
diff --git a/dhall/src/phase/typecheck.rs b/dhall/src/phase/typecheck.rs
index ef8340d..9a41be9 100644
--- a/dhall/src/phase/typecheck.rs
+++ b/dhall/src/phase/typecheck.rs
@@ -1,7 +1,7 @@
use std::cmp::max;
use std::collections::HashMap;
-use dhall_syntax::{
+use crate::syntax::{
Builtin, Const, Expr, ExprF, InterpolatedTextContents, Label, RawExpr, Span,
};
@@ -155,7 +155,7 @@ macro_rules! make_type {
(Double) => { ExprF::Builtin(Builtin::Double) };
(Text) => { ExprF::Builtin(Builtin::Text) };
($var:ident) => {
- ExprF::Var(dhall_syntax::V(stringify!($var).into(), 0))
+ ExprF::Var(crate::syntax::V(stringify!($var).into(), 0))
};
(Optional $ty:ident) => {
ExprF::App(
@@ -170,7 +170,7 @@ macro_rules! make_type {
)
};
({ $($label:ident : $ty:ident),* }) => {{
- let mut kts = dhall_syntax::map::DupTreeMap::new();
+ let mut kts = crate::syntax::map::DupTreeMap::new();
$(
kts.insert(
Label::from(stringify!($label)),
@@ -203,7 +203,7 @@ macro_rules! make_type {
}
fn type_of_builtin<E>(b: Builtin) -> Expr<E> {
- use dhall_syntax::Builtin::*;
+ use crate::syntax::Builtin::*;
rc(match b {
Bool | Natural | Integer | Double | Text => make_type!(Type),
List | Optional => make_type!(
@@ -303,7 +303,7 @@ fn type_with(
ctx: &TypecheckContext,
e: Expr<Normalized>,
) -> Result<Value, TypeError> {
- use dhall_syntax::ExprF::{Annot, Embed, Lam, Let, Pi, Var};
+ use crate::syntax::ExprF::{Annot, Embed, Lam, Let, Pi, Var};
let span = e.span();
Ok(match e.as_ref() {
@@ -362,10 +362,10 @@ fn type_last_layer(
span: Span,
) -> Result<Value, TypeError> {
use crate::error::TypeMessage::*;
- use dhall_syntax::BinOp::*;
- use dhall_syntax::Builtin::*;
- use dhall_syntax::Const::Type;
- use dhall_syntax::ExprF::*;
+ use crate::syntax::BinOp::*;
+ use crate::syntax::Builtin::*;
+ use crate::syntax::Const::Type;
+ use crate::syntax::ExprF::*;
let mkerr = |msg: TypeMessage| Err(TypeError::new(ctx, msg));
/// Intermediary return type
@@ -434,7 +434,7 @@ fn type_last_layer(
}
EmptyListLit(t) => {
match &*t.as_whnf() {
- ValueF::AppliedBuiltin(dhall_syntax::Builtin::List, args)
+ ValueF::AppliedBuiltin(crate::syntax::Builtin::List, args)
if args.len() == 1 => {}
_ => return mkerr(InvalidListType(t.clone())),
}
@@ -457,7 +457,7 @@ fn type_last_layer(
return mkerr(InvalidListType(t));
}
- RetTypeOnly(Value::from_builtin(dhall_syntax::Builtin::List).app(t))
+ RetTypeOnly(Value::from_builtin(crate::syntax::Builtin::List).app(t))
}
SomeLit(x) => {
let t = x.get_type()?;
@@ -466,7 +466,7 @@ fn type_last_layer(
}
RetTypeOnly(
- Value::from_builtin(dhall_syntax::Builtin::Optional).app(t),
+ Value::from_builtin(crate::syntax::Builtin::Optional).app(t),
)
}
RecordType(kts) => RetWhole(tck_record_type(