summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/text/printer.rs
diff options
context:
space:
mode:
authorNadrieril2020-04-06 22:11:54 +0100
committerNadrieril2020-04-06 22:11:54 +0100
commitfff4c46e09d4edf25eba737f4d71bfdb1dbf4a82 (patch)
tree30f48f45ba0201859193510c65edfd3634764090 /dhall/src/syntax/text/printer.rs
parentcd3b11cc8bd7c4397071d1d3b4b9020b7d5ff2ad (diff)
Extract operation-related code to a new module
Diffstat (limited to 'dhall/src/syntax/text/printer.rs')
-rw-r--r--dhall/src/syntax/text/printer.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs
index d655489..a85f435 100644
--- a/dhall/src/syntax/text/printer.rs
+++ b/dhall/src/syntax/text/printer.rs
@@ -1,3 +1,4 @@
+use crate::operations::OpKind;
use crate::syntax::*;
use itertools::Itertools;
use std::fmt::{self, Display};
@@ -37,8 +38,8 @@ impl<'a> PhasedExpr<'a> {
impl UnspannedExpr {
// Annotate subexpressions with the appropriate phase, defaulting to Base
fn annotate_with_phases(&self) -> ExprKind<PhasedExpr<'_>> {
- use crate::syntax::ExprKind::*;
- use crate::syntax::OpKind::*;
+ use ExprKind::*;
+ use OpKind::*;
use PrintPhase::*;
let with_base = self.map_ref(|e| PhasedExpr(e, Base));
match with_base {
@@ -89,8 +90,8 @@ impl UnspannedExpr {
f: &mut fmt::Formatter,
phase: PrintPhase,
) -> Result<(), fmt::Error> {
- use crate::syntax::ExprKind::*;
- use crate::syntax::OpKind::*;
+ use ExprKind::*;
+ use OpKind::*;
let needs_paren = match self {
Lam(_, _, _)
@@ -212,7 +213,7 @@ impl<SE: Display + Clone> Display for ExprKind<SE> {
/// Generic instance that delegates to subexpressions
impl<SE: Display + Clone> Display for OpKind<SE> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
- use crate::syntax::OpKind::*;
+ use OpKind::*;
match self {
App(a, b) => {
write!(f, "{} {}", a, b)?;