summaryrefslogtreecommitdiff
path: root/utils/check-exact/ExactPrint.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils/check-exact/ExactPrint.hs')
-rw-r--r--utils/check-exact/ExactPrint.hs30
1 files changed, 16 insertions, 14 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 8f4f89e265..80ef0eb19c 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -50,17 +50,17 @@ import Types
-- ---------------------------------------------------------------------
-exactPrint :: ExactPrint ast => Located ast -> ApiAnns -> String
-exactPrint ast anns = runIdentity (runEP anns stringOptions (markAnnotated ast))
+exactPrint :: ExactPrint ast => Located ast -> String
+exactPrint ast = runIdentity (runEP stringOptions (markAnnotated ast))
type EP w m a = RWST (PrintOptions m w) (EPWriter w) EPState m a
type EPP a = EP String Identity a
-runEP :: ApiAnns -> PrintOptions Identity String
+runEP :: PrintOptions Identity String
-> Annotated () -> Identity String
-runEP anns epReader action =
+runEP epReader action =
fmap (output . snd) .
- (\next -> execRWST next epReader (defaultEPState anns))
+ (\next -> execRWST next epReader defaultEPState)
. xx $ action
xx :: Annotated () -> EP String Identity ()
@@ -69,10 +69,9 @@ xx = id
-- ---------------------------------------------------------------------
-defaultEPState :: ApiAnns -> EPState
-defaultEPState as = EPState
+defaultEPState :: EPState
+defaultEPState = EPState
{ epPos = (1,1)
- , epApiAnns = as
, dLHS = 1
, pMarkLayout = False
, pLHS = 1
@@ -80,7 +79,7 @@ defaultEPState as = EPState
, dPriorEndPosition = (1,1)
, uAnchorSpan = badRealSrcSpan
, uExtraDP = Nothing
- , epComments = rogueComments as
+ , epComments = []
}
@@ -130,9 +129,7 @@ instance Monoid w => Monoid (EPWriter w) where
mempty = EPWriter mempty
data EPState = EPState
- { epApiAnns :: !ApiAnns
-
- , uAnchorSpan :: !RealSrcSpan -- ^ in pre-changed AST
+ { uAnchorSpan :: !RealSrcSpan -- ^ in pre-changed AST
-- reference frame, from
-- Annotation
, uExtraDP :: !(Maybe Anchor) -- ^ Used to anchor a
@@ -3628,7 +3625,9 @@ instance ExactPrint (Pat GhcPs) where
-- filtered.
let pun_RDR = "pun-right-hand-side"
when (showPprUnsafe n /= pun_RDR) $ markAnnotated n
- -- | LazyPat an pat)
+ exact (LazyPat an pat) = do
+ markApiAnn an AnnTilde
+ markAnnotated pat
exact (AsPat an n pat) = do
markAnnotated n
markApiAnn an AnnAt
@@ -3638,7 +3637,10 @@ instance ExactPrint (Pat GhcPs) where
markAnnotated pat
markAnnKw an ap_close AnnCloseP
- -- | BangPat an pat)
+ exact (BangPat an pat) = do
+ markApiAnn an AnnBang
+ markAnnotated pat
+
exact (ListPat an pats) = markAnnList an (markAnnotated pats)
exact (TuplePat an pats boxity) = do