Skip to content

Commit f23a4fc

Browse files
author
Brian Huffman
committed
Redefine precContains more simply in terms of (<=).
1 parent 6d3f39c commit f23a4fc

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

saw-core/src/Verifier/SAW/Term/Pretty.hs

+2-12
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,13 @@ data Prec
119119
| PrecProd -- ^ Nonterminal 'ProductTerm'
120120
| PrecApp -- ^ Nonterminal 'AppTerm'
121121
| PrecArg -- ^ Nonterminal 'AtomTerm'
122+
deriving (Eq, Ord)
122123

123124
-- | Test if the first precedence "contains" the second, meaning that terms at
124125
-- the latter precedence level can be printed in the context of the former
125126
-- without parentheses.
126-
--
127-
-- NOTE: we write this explicitly here, instead of generating it from an 'Ord'
128-
-- instance, so that readers of this code understand it and know what it is.
129127
precContains :: Prec -> Prec -> Bool
130-
precContains _ PrecArg = True
131-
precContains PrecArg _ = False
132-
precContains _ PrecApp = True
133-
precContains PrecApp _ = False
134-
precContains _ PrecProd = True
135-
precContains PrecProd _ = False
136-
precContains _ PrecLambda = True
137-
precContains PrecLambda _ = False
138-
precContains PrecNone PrecNone = True
128+
precContains x y = x <= y
139129

140130
-- | Optionally print parentheses around a document, iff the incoming, outer
141131
-- precedence (listed first) contains (as in 'precContains') the required

0 commit comments

Comments
 (0)