Skip to content

Commit

Permalink
Merge pull request #288 from GaloisInc/vr/pp-eqc-without-prov
Browse files Browse the repository at this point in the history
make `ppEqCWithProv` usable by the `Pretty` instance
  • Loading branch information
Ptival authored Sep 29, 2023
2 parents b21b80b + 8d3f97c commit 17c2dce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Reopt/TypeInference/Solver/Constraints.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ prettySExp docs = PP.group $ PP.encloseSep "(" ")" " " docs
-- output relatively compact. Use 'ppEqCWithProv' if you want to include
-- 'eqProv'.
instance PP.Pretty EqC where
pretty (EqC l r _prov) = prettySExp [PP.pretty l, "=", PP.pretty r]
pretty = ppEqCWithoutProv
-- pretty = ppEqCWithProv

-- | Pretty-print an 'EqC', omitting its provenance.
ppEqCWithoutProv :: EqC -> PP.Doc ann
ppEqCWithoutProv (EqC l r _) = prettySExp [PP.pretty l, "=", PP.pretty r]

-- | Pretty-print an 'EqC', including its provenance.
ppEqCWithProv :: EqC -> PP.Doc ann
ppEqCWithProv eqC =
PP.align $
PP.vsep
[ PP.pretty eqC
[ ppEqCWithoutProv eqC
, PP.hang 2 $ "Provenance: " <> PP.pretty (eqProv eqC)
]

Expand Down

0 comments on commit 17c2dce

Please sign in to comment.