{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DataKinds #-}
module GHC.Hs.Dump (
showAstData,
showAstDataFull,
BlankSrcSpan(..),
BlankEpAnnotations(..),
) where
import GHC.Prelude
import GHC.Hs
import GHC.Core.DataCon
import GHC.Data.Bag
import GHC.Data.FastString
import GHC.Types.Name.Set
import GHC.Types.Name
import GHC.Types.SrcLoc
import GHC.Types.Var
import GHC.Types.SourceText
import GHC.Utils.Outputable
import Data.Data hiding (Fixity)
import qualified Data.ByteString as B
import GHC.TypeLits
data BlankSrcSpan = BlankSrcSpan | BlankSrcSpanFile | NoBlankSrcSpan
deriving (BlankSrcSpan -> BlankSrcSpan -> Bool
(BlankSrcSpan -> BlankSrcSpan -> Bool)
-> (BlankSrcSpan -> BlankSrcSpan -> Bool) -> Eq BlankSrcSpan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BlankSrcSpan -> BlankSrcSpan -> Bool
== :: BlankSrcSpan -> BlankSrcSpan -> Bool
$c/= :: BlankSrcSpan -> BlankSrcSpan -> Bool
/= :: BlankSrcSpan -> BlankSrcSpan -> Bool
Eq,Int -> BlankSrcSpan -> ShowS
[BlankSrcSpan] -> ShowS
BlankSrcSpan -> String
(Int -> BlankSrcSpan -> ShowS)
-> (BlankSrcSpan -> String)
-> ([BlankSrcSpan] -> ShowS)
-> Show BlankSrcSpan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BlankSrcSpan -> ShowS
showsPrec :: Int -> BlankSrcSpan -> ShowS
$cshow :: BlankSrcSpan -> String
show :: BlankSrcSpan -> String
$cshowList :: [BlankSrcSpan] -> ShowS
showList :: [BlankSrcSpan] -> ShowS
Show)
data BlankEpAnnotations = BlankEpAnnotations | NoBlankEpAnnotations
deriving (BlankEpAnnotations -> BlankEpAnnotations -> Bool
(BlankEpAnnotations -> BlankEpAnnotations -> Bool)
-> (BlankEpAnnotations -> BlankEpAnnotations -> Bool)
-> Eq BlankEpAnnotations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BlankEpAnnotations -> BlankEpAnnotations -> Bool
== :: BlankEpAnnotations -> BlankEpAnnotations -> Bool
$c/= :: BlankEpAnnotations -> BlankEpAnnotations -> Bool
/= :: BlankEpAnnotations -> BlankEpAnnotations -> Bool
Eq,Int -> BlankEpAnnotations -> ShowS
[BlankEpAnnotations] -> ShowS
BlankEpAnnotations -> String
(Int -> BlankEpAnnotations -> ShowS)
-> (BlankEpAnnotations -> String)
-> ([BlankEpAnnotations] -> ShowS)
-> Show BlankEpAnnotations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BlankEpAnnotations -> ShowS
showsPrec :: Int -> BlankEpAnnotations -> ShowS
$cshow :: BlankEpAnnotations -> String
show :: BlankEpAnnotations -> String
$cshowList :: [BlankEpAnnotations] -> ShowS
showList :: [BlankEpAnnotations] -> ShowS
Show)
showAstDataFull :: Data a => a -> SDoc
showAstDataFull :: forall a. Data a => a -> SDoc
showAstDataFull = BlankSrcSpan -> BlankEpAnnotations -> a -> SDoc
forall a. Data a => BlankSrcSpan -> BlankEpAnnotations -> a -> SDoc
showAstData BlankSrcSpan
NoBlankSrcSpan BlankEpAnnotations
NoBlankEpAnnotations
showAstData :: Data a => BlankSrcSpan -> BlankEpAnnotations -> a -> SDoc
showAstData :: forall a. Data a => BlankSrcSpan -> BlankEpAnnotations -> a -> SDoc
showAstData BlankSrcSpan
bs BlankEpAnnotations
ba a
a0 = SDoc
blankLine SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ a -> SDoc
forall a. Data a => a -> SDoc
showAstData' a
a0
where
showAstData' :: Data a => a -> SDoc
showAstData' :: forall a. Data a => a -> SDoc
showAstData' =
a -> SDoc
forall a. Data a => a -> SDoc
generic
(a -> SDoc) -> (forall e. Data e => [e] -> SDoc) -> a -> SDoc
forall d (t :: * -> *) q.
(Data d, Typeable t) =>
(d -> q) -> (forall e. Data e => t e -> q) -> d -> q
`ext1Q` [e] -> SDoc
forall e. Data e => [e] -> SDoc
list
(a -> SDoc) -> ([EpaLocation] -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` [EpaLocation] -> SDoc
list_epaLocation
(a -> SDoc) -> ([EpToken "("] -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` [EpToken "("] -> SDoc
list_epTokenOpenP
(a -> SDoc) -> ([EpToken ")"] -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` [EpToken ")"] -> SDoc
list_epTokenCloseP
(a -> SDoc) -> (String -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` String -> SDoc
string (a -> SDoc) -> (FastString -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` FastString -> SDoc
fastString (a -> SDoc) -> (SrcSpan -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` SrcSpan -> SDoc
srcSpan (a -> SDoc) -> (RealSrcSpan -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` RealSrcSpan -> SDoc
realSrcSpan
(a -> SDoc) -> (EpAnn AnnsModule -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn AnnsModule -> SDoc
annotationModule
(a -> SDoc) -> (EpAnn GrhsAnn -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn GrhsAnn -> SDoc
annotationGrhsAnn
(a -> SDoc) -> (EpAnn (AnnList ()) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn (AnnList ()) -> SDoc
annotationAnnList
(a -> SDoc)
-> (EpAnn (AnnList (EpToken "where")) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn (AnnList (EpToken "where")) -> SDoc
annotationAnnListWhere
(a -> SDoc) -> (EpAnn (AnnList [EpToken ","]) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn (AnnList [EpToken ","]) -> SDoc
annotationAnnListCommas
(a -> SDoc)
-> (EpAnn (AnnList (EpToken "hiding", [EpToken ","])) -> SDoc)
-> a
-> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn (AnnList (EpToken "hiding", [EpToken ","])) -> SDoc
annotationAnnListIE
(a -> SDoc) -> (EpAnn EpAnnImportDecl -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn EpAnnImportDecl -> SDoc
annotationEpAnnImportDecl
(a -> SDoc) -> (EpAnn NoEpAnns -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn NoEpAnns -> SDoc
annotationNoEpAnns
(a -> SDoc)
-> (BracketAnn (EpUniToken "[|" "\10214") (EpToken "[e|") -> SDoc)
-> a
-> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` BracketAnn (EpUniToken "[|" "\10214") (EpToken "[e|") -> SDoc
annotationExprBracket
(a -> SDoc)
-> (BracketAnn (EpToken "[||") (EpToken "[e||") -> SDoc)
-> a
-> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` BracketAnn (EpToken "[||") (EpToken "[e||") -> SDoc
annotationTypedBracket
(a -> SDoc) -> (EpToken "{" -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpToken "{" -> SDoc
epTokenOC
(a -> SDoc) -> (EpToken "}" -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpToken "}" -> SDoc
epTokenCC
(a -> SDoc) -> (EpToken "instance" -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpToken "instance" -> SDoc
epTokenInstance
(a -> SDoc) -> (TokForall -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` TokForall -> SDoc
epTokenForall
(a -> SDoc) -> (AnnParen -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnParen -> SDoc
annParen
(a -> SDoc) -> (AnnClassDecl -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnClassDecl -> SDoc
annClassDecl
(a -> SDoc) -> (AnnSynDecl -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnSynDecl -> SDoc
annSynDecl
(a -> SDoc) -> (AnnDataDefn -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnDataDefn -> SDoc
annDataDefn
(a -> SDoc) -> (AnnFamilyDecl -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnFamilyDecl -> SDoc
annFamilyDecl
(a -> SDoc) -> (AnnClsInstDecl -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` AnnClsInstDecl -> SDoc
annClsInstDecl
(a -> SDoc) -> (HsLit GhcPs -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` HsLit GhcPs -> SDoc
lit (a -> SDoc) -> (HsLit GhcRn -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` HsLit GhcRn -> SDoc
litr (a -> SDoc) -> (HsLit GhcTc -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` HsLit GhcTc -> SDoc
litt
(a -> SDoc) -> (SourceText -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` SourceText -> SDoc
sourceText
(a -> SDoc) -> (DeltaPos -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` DeltaPos -> SDoc
deltaPos
(a -> SDoc) -> (EpaLocation -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpaLocation -> SDoc
epaLocation
(a -> SDoc) -> (Maybe EpaLocation -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Maybe EpaLocation -> SDoc
maybe_epaLocation
(a -> SDoc) -> (ByteString -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` ByteString -> SDoc
bytestring
(a -> SDoc) -> (Name -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Name -> SDoc
name (a -> SDoc) -> (OccName -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` OccName -> SDoc
forall {b}. IsLine b => OccName -> b
occName (a -> SDoc) -> (ModuleName -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` ModuleName -> SDoc
moduleName (a -> SDoc) -> (Var -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Var -> SDoc
var
(a -> SDoc) -> (DataCon -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` DataCon -> SDoc
dataCon
(a -> SDoc) -> (Bag (LocatedA (HsBind GhcRn)) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Bag (LocatedA (HsBind GhcRn)) -> SDoc
bagName (a -> SDoc) -> (Bag (LocatedA (HsBind GhcPs)) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Bag (LocatedA (HsBind GhcPs)) -> SDoc
bagRdrName (a -> SDoc) -> (Bag (LocatedA (HsBind GhcTc)) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` Bag (LocatedA (HsBind GhcTc)) -> SDoc
bagVar (a -> SDoc) -> (NameSet -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` NameSet -> SDoc
nameSet
(a -> SDoc)
-> (forall d1 d2. (Data d1, Data d2) => GenLocated d1 d2 -> SDoc)
-> a
-> SDoc
forall d (t :: * -> * -> *) q.
(Data d, Typeable t) =>
(d -> q)
-> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q) -> d -> q
`ext2Q` GenLocated d1 d2 -> SDoc
forall d1 d2. (Data d1, Data d2) => GenLocated d1 d2 -> SDoc
located
(a -> SDoc) -> (EpAnn AnnListItem -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn AnnListItem -> SDoc
srcSpanAnnA
(a -> SDoc) -> (EpAnn (AnnList ()) -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn (AnnList ()) -> SDoc
srcSpanAnnL
(a -> SDoc) -> (EpAnn AnnPragma -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn AnnPragma -> SDoc
srcSpanAnnP
(a -> SDoc) -> (EpAnn AnnContext -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn AnnContext -> SDoc
srcSpanAnnC
(a -> SDoc) -> (EpAnn NameAnn -> SDoc) -> a -> SDoc
forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
`extQ` EpAnn NameAnn -> SDoc
srcSpanAnnN
where generic :: Data a => a -> SDoc
generic :: forall a. Data a => a -> SDoc
generic a
t = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text (Constr -> String
showConstr (a -> Constr
forall a. Data a => a -> Constr
toConstr a
t))
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((forall a. Data a => a -> SDoc) -> a -> [SDoc]
forall a u. Data a => (forall d. Data d => d -> u) -> a -> [u]
forall u. (forall d. Data d => d -> u) -> a -> [u]
gmapQ d -> SDoc
forall a. Data a => a -> SDoc
showAstData' a
t)
string :: String -> SDoc
string :: String -> SDoc
string = String -> SDoc
forall doc. IsLine doc => String -> doc
text (String -> SDoc) -> ShowS -> String -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
normalize_newlines ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
forall a. Show a => a -> String
show
fastString :: FastString -> SDoc
fastString :: FastString -> SDoc
fastString FastString
s = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"FastString:"
SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text (ShowS
normalize_newlines ShowS -> (FastString -> String) -> FastString -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. FastString -> String
forall a. Show a => a -> String
show (FastString -> String) -> FastString -> String
forall a b. (a -> b) -> a -> b
$ FastString
s)
bytestring :: B.ByteString -> SDoc
bytestring :: ByteString -> SDoc
bytestring = String -> SDoc
forall doc. IsLine doc => String -> doc
text (String -> SDoc) -> (ByteString -> String) -> ByteString -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
normalize_newlines ShowS -> (ByteString -> String) -> ByteString -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> String
forall a. Show a => a -> String
show
list_epaLocation :: [EpaLocation] -> SDoc
list_epaLocation :: [EpaLocation] -> SDoc
list_epaLocation [EpaLocation]
ls = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"[EpaLocation]"
BlankEpAnnotations
NoBlankEpAnnotations -> [EpaLocation] -> SDoc
forall e. Data e => [e] -> SDoc
list [EpaLocation]
ls
list_epTokenOpenP :: [EpToken "("] -> SDoc
list_epTokenOpenP :: [EpToken "("] -> SDoc
list_epTokenOpenP [EpToken "("]
ls = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"[EpToken \"(\"]"
BlankEpAnnotations
NoBlankEpAnnotations -> [EpToken "("] -> SDoc
forall e. Data e => [e] -> SDoc
list [EpToken "("]
ls
list_epTokenCloseP :: [EpToken ")"] -> SDoc
list_epTokenCloseP :: [EpToken ")"] -> SDoc
list_epTokenCloseP [EpToken ")"]
ls = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"[EpToken \"(\"]"
BlankEpAnnotations
NoBlankEpAnnotations -> [EpToken ")"] -> SDoc
forall e. Data e => [e] -> SDoc
list [EpToken ")"]
ls
list :: [t] -> SDoc
list [] = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
brackets SDoc
forall doc. IsOutput doc => doc
empty
list [t
x] = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
brackets (t -> SDoc
forall a. Data a => a -> SDoc
showAstData' t
x)
list (t
x1 : t
x2 : [t]
xs) = (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"[" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> t -> SDoc
forall a. Data a => a -> SDoc
showAstData' t
x1)
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ t -> [t] -> SDoc
forall {t}. Data t => t -> [t] -> SDoc
go t
x2 [t]
xs
where
go :: t -> [t] -> SDoc
go t
y [] = String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"," SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> t -> SDoc
forall a. Data a => a -> SDoc
showAstData' t
y SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"]"
go t
y1 (t
y2 : [t]
ys) = (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"," SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> t -> SDoc
forall a. Data a => a -> SDoc
showAstData' t
y1) SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ t -> [t] -> SDoc
go t
y2 [t]
ys
lit :: HsLit GhcPs -> SDoc
lit :: HsLit GhcPs -> SDoc
lit (HsWordPrim XHsWordPrim GhcPs
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWordPrim GhcPs
SourceText
s
lit (HsWord64Prim XHsWord64Prim GhcPs
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWord64Prim GhcPs
SourceText
s
lit (HsIntPrim XHsIntPrim GhcPs
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsIntPrim GhcPs
SourceText
s
lit (HsInt64Prim XHsInt64Prim GhcPs
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsInt64Prim GhcPs
SourceText
s
lit HsLit GhcPs
l = HsLit GhcPs -> SDoc
forall a. Data a => a -> SDoc
generic HsLit GhcPs
l
litr :: HsLit GhcRn -> SDoc
litr :: HsLit GhcRn -> SDoc
litr (HsWordPrim XHsWordPrim GhcRn
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWordPrim GhcRn
SourceText
s
litr (HsWord64Prim XHsWord64Prim GhcRn
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWord64Prim GhcRn
SourceText
s
litr (HsIntPrim XHsIntPrim GhcRn
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsIntPrim GhcRn
SourceText
s
litr (HsInt64Prim XHsInt64Prim GhcRn
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsInt64Prim GhcRn
SourceText
s
litr HsLit GhcRn
l = HsLit GhcRn -> SDoc
forall a. Data a => a -> SDoc
generic HsLit GhcRn
l
litt :: HsLit GhcTc -> SDoc
litt :: HsLit GhcTc -> SDoc
litt (HsWordPrim XHsWordPrim GhcTc
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWordPrim GhcTc
SourceText
s
litt (HsWord64Prim XHsWord64Prim GhcTc
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsWord{64}Prim" Integer
x XHsWord64Prim GhcTc
SourceText
s
litt (HsIntPrim XHsIntPrim GhcTc
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsIntPrim GhcTc
SourceText
s
litt (HsInt64Prim XHsInt64Prim GhcTc
s Integer
x) = String -> Integer -> SourceText -> SDoc
numericLit String
"HsInt{64}Prim" Integer
x XHsInt64Prim GhcTc
SourceText
s
litt HsLit GhcTc
l = HsLit GhcTc -> SDoc
forall a. Data a => a -> SDoc
generic HsLit GhcTc
l
numericLit :: String -> Integer -> SourceText -> SDoc
numericLit :: String -> Integer -> SourceText -> SDoc
numericLit String
tag Integer
x SourceText
s = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ [SDoc] -> SDoc
forall doc. IsLine doc => [doc] -> doc
hsep [ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
tag
, Integer -> SDoc
forall a. Data a => a -> SDoc
generic Integer
x
, SourceText -> SDoc
forall a. Data a => a -> SDoc
generic SourceText
s ]
sourceText :: SourceText -> SDoc
sourceText :: SourceText -> SDoc
sourceText SourceText
NoSourceText = case BlankSrcSpan
bs of
BlankSrcSpan
BlankSrcSpan -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SourceText" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked"
BlankSrcSpan
_ -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"NoSourceText"
sourceText (SourceText FastString
src) = case BlankSrcSpan
bs of
BlankSrcSpan
BlankSrcSpan -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SourceText" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked"
BlankSrcSpan
_ -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SourceText" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> FastString -> SDoc
forall doc. IsLine doc => FastString -> doc
ftext FastString
src
epaLocation :: EpaLocation -> SDoc
epaLocation :: EpaLocation -> SDoc
epaLocation (EpaSpan SrcSpan
s) = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpaSpan" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
srcSpan SrcSpan
s
epaLocation (EpaDelta SrcSpan
s DeltaPos
d [LEpaComment]
cs) = case BlankEpAnnotations
ba of
BlankEpAnnotations
NoBlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpaDelta" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
srcSpan SrcSpan
s SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> DeltaPos -> SDoc
deltaPos DeltaPos
d SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> [LEpaComment] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [LEpaComment]
cs
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpaDelta" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SrcSpan -> SDoc
srcSpan SrcSpan
s SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> DeltaPos -> SDoc
deltaPos DeltaPos
d SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked"
maybe_epaLocation :: Maybe EpaLocation -> SDoc
maybe_epaLocation :: Maybe EpaLocation -> SDoc
maybe_epaLocation Maybe EpaLocation
ml = case BlankEpAnnotations
ba of
BlankEpAnnotations
NoBlankEpAnnotations -> case Maybe EpaLocation
ml of
Maybe EpaLocation
Nothing -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Nothing"
Just EpaLocation
l -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Just" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ EpaLocation -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpaLocation
l)
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Maybe EpaLocation:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked"
deltaPos :: DeltaPos -> SDoc
deltaPos :: DeltaPos -> SDoc
deltaPos (SameLine Int
c) = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SameLine" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Int -> SDoc
forall a. Outputable a => a -> SDoc
ppr Int
c
deltaPos (DifferentLine Int
l Int
c) = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"DifferentLine" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Int -> SDoc
forall a. Outputable a => a -> SDoc
ppr Int
l SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Int -> SDoc
forall a. Outputable a => a -> SDoc
ppr Int
c
name :: Name -> SDoc
name :: Name -> SDoc
name Name
nm = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Name:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
nm
occName :: OccName -> b
occName OccName
n = b -> b
forall doc. IsLine doc => doc -> doc
braces (b -> b) -> b -> b
forall a b. (a -> b) -> a -> b
$
String -> b
forall doc. IsLine doc => String -> doc
text String
"OccName:"
b -> b -> b
forall doc. IsLine doc => doc -> doc -> doc
<+> FastString -> b
forall doc. IsLine doc => FastString -> doc
ftext (OccName -> FastString
occNameFS OccName
n)
moduleName :: ModuleName -> SDoc
moduleName :: ModuleName -> SDoc
moduleName ModuleName
m = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"ModuleName:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> ModuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModuleName
m
srcSpan :: SrcSpan -> SDoc
srcSpan :: SrcSpan -> SDoc
srcSpan SrcSpan
ss = case BlankSrcSpan
bs of
BlankSrcSpan
BlankSrcSpan -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"{ ss }"
BlankSrcSpan
NoBlankSrcSpan -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' ' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> (SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr SrcSpan
ss) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' '
BlankSrcSpan
BlankSrcSpanFile -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' ' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> (Bool -> SrcSpan -> SDoc
pprUserSpan Bool
False SrcSpan
ss) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' '
realSrcSpan :: RealSrcSpan -> SDoc
realSrcSpan :: RealSrcSpan -> SDoc
realSrcSpan RealSrcSpan
ss = case BlankSrcSpan
bs of
BlankSrcSpan
BlankSrcSpan -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"{ ss }"
BlankSrcSpan
NoBlankSrcSpan -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' ' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> (RealSrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr RealSrcSpan
ss) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' '
BlankSrcSpan
BlankSrcSpanFile -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' ' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> (Bool -> RealSrcSpan -> SDoc
pprUserRealSpan Bool
False RealSrcSpan
ss) SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
' '
annParen :: AnnParen -> SDoc
annParen :: AnnParen -> SDoc
annParen AnnParen
ap = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnParen"
BlankEpAnnotations
NoBlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (case AnnParen
ap of
(AnnParens EpToken "("
o EpToken ")"
c) -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnParens" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [EpToken "(" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "("
o, EpToken ")" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken ")"
c]
(AnnParensHash EpToken "(#"
o EpToken "#)"
c) -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnParensHash" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [EpToken "(#" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "(#"
o, EpToken "#)" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "#)"
c]
(AnnParensSquare EpToken "["
o EpToken "]"
c) -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnParensSquare" SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [EpToken "[" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "["
o, EpToken "]" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "]"
c]
)
annClassDecl :: AnnClassDecl -> SDoc
annClassDecl :: AnnClassDecl -> SDoc
annClassDecl (AnnClassDecl EpToken "class"
c [EpToken "("]
ops [EpToken ")"]
cps EpToken "|"
v EpToken "where"
w EpToken "{"
oc EpToken "}"
cc [EpToken ";"]
s) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnClassDecl"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnClassDecl"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [EpToken "class" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "class"
c, [EpToken "("] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken "("]
ops, [EpToken ")"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ")"]
cps,
EpToken "|" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "|"
v, EpToken "where" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "where"
w, EpToken "{" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "{"
oc,
EpToken "}" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "}"
cc, [EpToken ";"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ";"]
s]
annSynDecl :: AnnSynDecl -> SDoc
annSynDecl :: AnnSynDecl -> SDoc
annSynDecl (AnnSynDecl [EpToken "("]
ops [EpToken ")"]
cps EpToken "type"
t EpToken "="
e) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnSynDecl"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnSynDecl"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[EpToken "("] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken "("]
ops, [EpToken ")"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ")"]
cps,
EpToken "type" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "type"
t, EpToken "=" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "="
e]
annDataDefn :: AnnDataDefn -> SDoc
annDataDefn :: AnnDataDefn -> SDoc
annDataDefn (AnnDataDefn [EpToken "("]
a [EpToken ")"]
b EpToken "type"
c EpToken "newtype"
d EpToken "data"
e EpToken "instance"
f TokDcolon
g EpToken "where"
h EpToken "{"
i EpToken "}"
j EpToken "="
k) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnDataDefn"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnDataDefn"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[EpToken "("] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken "("]
a, [EpToken ")"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ")"]
b, EpToken "type" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "type"
c,
EpToken "newtype" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "newtype"
d, EpToken "data" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "data"
e, EpToken "instance" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "instance"
f,
TokDcolon -> SDoc
forall a. Data a => a -> SDoc
showAstData' TokDcolon
g, EpToken "where" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "where"
h, EpToken "{" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "{"
i,
EpToken "}" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "}"
j, EpToken "=" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "="
k]
annFamilyDecl :: AnnFamilyDecl -> SDoc
annFamilyDecl :: AnnFamilyDecl -> SDoc
annFamilyDecl (AnnFamilyDecl [EpToken "("]
a [EpToken ")"]
b EpToken "type"
c EpToken "data"
d EpToken "family"
e TokDcolon
f EpToken "="
g EpToken "|"
h EpToken "where"
i EpToken "{"
j EpToken ".."
k EpToken "}"
l) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnFamilyDecl"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnFamilyDecl"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [[EpToken "("] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken "("]
a, [EpToken ")"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ")"]
b, EpToken "type" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "type"
c,
EpToken "data" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "data"
d, EpToken "family" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "family"
e, TokDcolon -> SDoc
forall a. Data a => a -> SDoc
showAstData' TokDcolon
f,
EpToken "=" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "="
g, EpToken "|" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "|"
h, EpToken "where" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "where"
i,
EpToken "{" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "{"
j, EpToken ".." -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken ".."
k, EpToken "}" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "}"
l]
annClsInstDecl :: AnnClsInstDecl -> SDoc
annClsInstDecl :: AnnClsInstDecl -> SDoc
annClsInstDecl (AnnClsInstDecl EpToken "instance"
a EpToken "where"
b EpToken "{"
c [EpToken ";"]
d EpToken "}"
e) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnFamilyDecl"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"AnnClsInstDecl"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [EpToken "instance" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "instance"
a, EpToken "where" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "where"
b, EpToken "{" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "{"
c,
[EpToken ";"] -> SDoc
forall a. Data a => a -> SDoc
showAstData' [EpToken ";"]
d, EpToken "}" -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpToken "}"
e]
annotationExprBracket :: BracketAnn (EpUniToken "[|" "⟦") (EpToken "[e|") -> SDoc
annotationExprBracket :: BracketAnn (EpUniToken "[|" "\10214") (EpToken "[e|") -> SDoc
annotationExprBracket = BracketAnn (EpUniToken "[|" "\10214") (EpToken "[e|") -> SDoc
forall n h.
(Data n, Data h, Typeable n, Typeable h) =>
BracketAnn n h -> SDoc
annotationBracket
annotationTypedBracket :: BracketAnn (EpToken "[||") (EpToken "[e||") -> SDoc
annotationTypedBracket :: BracketAnn (EpToken "[||") (EpToken "[e||") -> SDoc
annotationTypedBracket = BracketAnn (EpToken "[||") (EpToken "[e||") -> SDoc
forall n h.
(Data n, Data h, Typeable n, Typeable h) =>
BracketAnn n h -> SDoc
annotationBracket
annotationBracket ::forall n h .(Data n, Data h, Typeable n, Typeable h)
=> BracketAnn n h -> SDoc
annotationBracket :: forall n h.
(Data n, Data h, Typeable n, Typeable h) =>
BracketAnn n h -> SDoc
annotationBracket BracketAnn n h
a = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"BracketAnn"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ case BracketAnn n h
a of
BracketNoE n
t -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"BracketNoE" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> n -> SDoc
forall a. Data a => a -> SDoc
showAstData' n
t
BracketHasE h
t -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"BracketHasE" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> h -> SDoc
forall a. Data a => a -> SDoc
showAstData' h
t
epTokenOC :: EpToken "{" -> SDoc
epTokenOC :: EpToken "{" -> SDoc
epTokenOC = EpToken "{" -> SDoc
forall (sym :: Symbol). KnownSymbol sym => EpToken sym -> SDoc
epToken'
epTokenCC :: EpToken "}" -> SDoc
epTokenCC :: EpToken "}" -> SDoc
epTokenCC = EpToken "}" -> SDoc
forall (sym :: Symbol). KnownSymbol sym => EpToken sym -> SDoc
epToken'
epTokenInstance :: EpToken "instance" -> SDoc
epTokenInstance :: EpToken "instance" -> SDoc
epTokenInstance = EpToken "instance" -> SDoc
forall (sym :: Symbol). KnownSymbol sym => EpToken sym -> SDoc
epToken'
epTokenForall :: TokForall -> SDoc
epTokenForall :: TokForall -> SDoc
epTokenForall = TokForall -> SDoc
forall (sym1 :: Symbol) (sym2 :: Symbol).
EpUniToken sym1 sym2 -> SDoc
epUniToken'
epToken' :: KnownSymbol sym => EpToken sym -> SDoc
epToken' :: forall (sym :: Symbol). KnownSymbol sym => EpToken sym -> SDoc
epToken' (EpTok EpaLocation
s) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpToken"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpTok" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> EpaLocation -> SDoc
epaLocation EpaLocation
s
epToken' EpToken sym
NoEpTok = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpToken"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"NoEpTok"
epUniToken' :: EpUniToken sym1 sym2 -> SDoc
epUniToken' :: forall (sym1 :: Symbol) (sym2 :: Symbol).
EpUniToken sym1 sym2 -> SDoc
epUniToken' (EpUniTok EpaLocation
s IsUnicodeSyntax
f) = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpUniToken"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpUniTok" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> EpaLocation -> SDoc
epaLocation EpaLocation
s SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> IsUnicodeSyntax -> SDoc
forall a. Outputable a => a -> SDoc
ppr IsUnicodeSyntax
f
epUniToken' EpUniToken sym1 sym2
NoEpUniTok = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens
(SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpUniToken"
BlankEpAnnotations
NoBlankEpAnnotations ->
SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"NoEpUniTok"
var :: Var -> SDoc
var :: Var -> SDoc
var Var
v = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Var:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> Var -> SDoc
forall a. Outputable a => a -> SDoc
ppr Var
v
dataCon :: DataCon -> SDoc
dataCon :: DataCon -> SDoc
dataCon DataCon
c = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"DataCon:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
c
bagRdrName:: Bag (LocatedA (HsBind GhcPs)) -> SDoc
bagRdrName :: Bag (LocatedA (HsBind GhcPs)) -> SDoc
bagRdrName Bag (LocatedA (HsBind GhcPs))
bg = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Bag(LocatedA (HsBind GhcPs)):"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ ([LocatedA (HsBind GhcPs)] -> SDoc
forall e. Data e => [e] -> SDoc
list ([LocatedA (HsBind GhcPs)] -> SDoc)
-> (Bag (LocatedA (HsBind GhcPs)) -> [LocatedA (HsBind GhcPs)])
-> Bag (LocatedA (HsBind GhcPs))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bag (LocatedA (HsBind GhcPs)) -> [LocatedA (HsBind GhcPs)]
forall a. Bag a -> [a]
bagToList (Bag (LocatedA (HsBind GhcPs)) -> SDoc)
-> Bag (LocatedA (HsBind GhcPs)) -> SDoc
forall a b. (a -> b) -> a -> b
$ Bag (LocatedA (HsBind GhcPs))
bg)
bagName :: Bag (LocatedA (HsBind GhcRn)) -> SDoc
bagName :: Bag (LocatedA (HsBind GhcRn)) -> SDoc
bagName Bag (LocatedA (HsBind GhcRn))
bg = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Bag(LocatedA (HsBind Name)):"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ ([LocatedA (HsBind GhcRn)] -> SDoc
forall e. Data e => [e] -> SDoc
list ([LocatedA (HsBind GhcRn)] -> SDoc)
-> (Bag (LocatedA (HsBind GhcRn)) -> [LocatedA (HsBind GhcRn)])
-> Bag (LocatedA (HsBind GhcRn))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bag (LocatedA (HsBind GhcRn)) -> [LocatedA (HsBind GhcRn)]
forall a. Bag a -> [a]
bagToList (Bag (LocatedA (HsBind GhcRn)) -> SDoc)
-> Bag (LocatedA (HsBind GhcRn)) -> SDoc
forall a b. (a -> b) -> a -> b
$ Bag (LocatedA (HsBind GhcRn))
bg)
bagVar :: Bag (LocatedA (HsBind GhcTc)) -> SDoc
bagVar :: Bag (LocatedA (HsBind GhcTc)) -> SDoc
bagVar Bag (LocatedA (HsBind GhcTc))
bg = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"Bag(LocatedA (HsBind Var)):"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ ([LocatedA (HsBind GhcTc)] -> SDoc
forall e. Data e => [e] -> SDoc
list ([LocatedA (HsBind GhcTc)] -> SDoc)
-> (Bag (LocatedA (HsBind GhcTc)) -> [LocatedA (HsBind GhcTc)])
-> Bag (LocatedA (HsBind GhcTc))
-> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bag (LocatedA (HsBind GhcTc)) -> [LocatedA (HsBind GhcTc)]
forall a. Bag a -> [a]
bagToList (Bag (LocatedA (HsBind GhcTc)) -> SDoc)
-> Bag (LocatedA (HsBind GhcTc)) -> SDoc
forall a b. (a -> b) -> a -> b
$ Bag (LocatedA (HsBind GhcTc))
bg)
nameSet :: NameSet -> SDoc
nameSet NameSet
ns = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
braces (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"NameSet:"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ ([Name] -> SDoc
forall e. Data e => [e] -> SDoc
list ([Name] -> SDoc) -> (NameSet -> [Name]) -> NameSet -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NameSet -> [Name]
nameSetElemsStable (NameSet -> SDoc) -> NameSet -> SDoc
forall a b. (a -> b) -> a -> b
$ NameSet
ns)
located :: (Data a, Data b) => GenLocated a b -> SDoc
located :: forall d1 d2. (Data d1, Data d2) => GenLocated d1 d2 -> SDoc
located (L a
ss b
a)
= SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"L"
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat [a -> SDoc
forall a. Data a => a -> SDoc
showAstData' a
ss, b -> SDoc
forall a. Data a => a -> SDoc
showAstData' b
a])
annotationModule :: EpAnn AnnsModule -> SDoc
annotationModule :: EpAnn AnnsModule -> SDoc
annotationModule = SDoc -> EpAnn AnnsModule -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn AnnsModule")
annotationGrhsAnn :: EpAnn GrhsAnn -> SDoc
annotationGrhsAnn :: EpAnn GrhsAnn -> SDoc
annotationGrhsAnn = SDoc -> EpAnn GrhsAnn -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn GrhsAnn")
annotationAnnList :: EpAnn (AnnList ()) -> SDoc
annotationAnnList :: EpAnn (AnnList ()) -> SDoc
annotationAnnList = SDoc -> EpAnn (AnnList ()) -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn (AnnList ())")
annotationAnnListWhere :: EpAnn (AnnList (EpToken "where")) -> SDoc
annotationAnnListWhere :: EpAnn (AnnList (EpToken "where")) -> SDoc
annotationAnnListWhere = SDoc -> EpAnn (AnnList (EpToken "where")) -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn (AnnList (EpToken \"where\"))")
annotationAnnListCommas :: EpAnn (AnnList [EpToken ","]) -> SDoc
annotationAnnListCommas :: EpAnn (AnnList [EpToken ","]) -> SDoc
annotationAnnListCommas = SDoc -> EpAnn (AnnList [EpToken ","]) -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn (AnnList [EpToken \",\"])")
annotationAnnListIE :: EpAnn (AnnList (EpToken "hiding", [EpToken ","])) -> SDoc
annotationAnnListIE :: EpAnn (AnnList (EpToken "hiding", [EpToken ","])) -> SDoc
annotationAnnListIE = SDoc -> EpAnn (AnnList (EpToken "hiding", [EpToken ","])) -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn (AnnList (EpToken \"hiding\", [EpToken \",\"]))")
annotationEpAnnImportDecl :: EpAnn EpAnnImportDecl -> SDoc
annotationEpAnnImportDecl :: EpAnn EpAnnImportDecl -> SDoc
annotationEpAnnImportDecl = SDoc -> EpAnn EpAnnImportDecl -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn EpAnnImportDecl")
annotationNoEpAnns :: EpAnn NoEpAnns -> SDoc
annotationNoEpAnns :: EpAnn NoEpAnns -> SDoc
annotationNoEpAnns = SDoc -> EpAnn NoEpAnns -> SDoc
forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"EpAnn NoEpAnns")
annotation' :: forall a .(Data a, Typeable a)
=> SDoc -> EpAnn a -> SDoc
annotation' :: forall a. (Data a, Typeable a) => SDoc -> EpAnn a -> SDoc
annotation' SDoc
tag EpAnn a
anns = case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
tag)
BlankEpAnnotations
NoBlankEpAnnotations -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text (Constr -> String
showConstr (EpAnn a -> Constr
forall a. Data a => a -> Constr
toConstr EpAnn a
anns))
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((forall a. Data a => a -> SDoc) -> EpAnn a -> [SDoc]
forall a u. Data a => (forall d. Data d => d -> u) -> a -> [u]
forall u. (forall d. Data d => d -> u) -> EpAnn a -> [u]
gmapQ d -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpAnn a
anns)
srcSpanAnnA :: EpAnn AnnListItem -> SDoc
srcSpanAnnA :: EpAnn AnnListItem -> SDoc
srcSpanAnnA = SDoc -> EpAnn AnnListItem -> SDoc
forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SrcSpanAnnA")
srcSpanAnnL :: EpAnn (AnnList ()) -> SDoc
srcSpanAnnL :: EpAnn (AnnList ()) -> SDoc
srcSpanAnnL = SDoc -> EpAnn (AnnList ()) -> SDoc
forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SrcSpanAnnL")
srcSpanAnnP :: EpAnn AnnPragma -> SDoc
srcSpanAnnP :: EpAnn AnnPragma -> SDoc
srcSpanAnnP = SDoc -> EpAnn AnnPragma -> SDoc
forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SrcSpanAnnP")
srcSpanAnnC :: EpAnn AnnContext -> SDoc
srcSpanAnnC :: EpAnn AnnContext -> SDoc
srcSpanAnnC = SDoc -> EpAnn AnnContext -> SDoc
forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SrcSpanAnnC")
srcSpanAnnN :: EpAnn NameAnn -> SDoc
srcSpanAnnN :: EpAnn NameAnn -> SDoc
srcSpanAnnN = SDoc -> EpAnn NameAnn -> SDoc
forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"SrcSpanAnnN")
locatedAnn'' :: forall a. (Typeable a, Data a)
=> SDoc -> EpAnn a -> SDoc
locatedAnn'' :: forall a. (Typeable a, Data a) => SDoc -> EpAnn a -> SDoc
locatedAnn'' SDoc
tag EpAnn a
ss = SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$
case EpAnn a -> Maybe (EpAnn a)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast EpAnn a
ss of
Just (EpAnn a
ann :: EpAnn a) ->
case BlankEpAnnotations
ba of
BlankEpAnnotations
BlankEpAnnotations
-> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"blanked:" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
tag)
BlankEpAnnotations
NoBlankEpAnnotations
-> String -> SDoc
forall doc. IsLine doc => String -> doc
text (Constr -> String
showConstr (EpAnn a -> Constr
forall a. Data a => a -> Constr
toConstr EpAnn a
ann))
SDoc -> SDoc -> SDoc
forall doc. IsDoc doc => doc -> doc -> doc
$$ [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat ((forall a. Data a => a -> SDoc) -> EpAnn a -> [SDoc]
forall a u. Data a => (forall d. Data d => d -> u) -> a -> [u]
forall u. (forall d. Data d => d -> u) -> EpAnn a -> [u]
gmapQ d -> SDoc
forall a. Data a => a -> SDoc
showAstData' EpAnn a
ann)
Maybe (EpAnn a)
Nothing -> String -> SDoc
forall doc. IsLine doc => String -> doc
text String
"locatedAnn:unmatched" SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> SDoc
tag
SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<+> (SDoc -> SDoc
forall doc. IsLine doc => doc -> doc
parens (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
forall doc. IsLine doc => String -> doc
text (Constr -> String
showConstr (EpAnn a -> Constr
forall a. Data a => a -> Constr
toConstr EpAnn a
ss)))
normalize_newlines :: String -> String
normalize_newlines :: ShowS
normalize_newlines (Char
'\\':Char
'r':Char
'\\':Char
'n':String
xs) = Char
'\\'Char -> ShowS
forall a. a -> [a] -> [a]
:Char
'n'Char -> ShowS
forall a. a -> [a] -> [a]
:ShowS
normalize_newlines String
xs
normalize_newlines (Char
x:String
xs) = Char
xChar -> ShowS
forall a. a -> [a] -> [a]
:ShowS
normalize_newlines String
xs
normalize_newlines [] = []
newtype Q q x = Q { forall q x. Q q x -> x -> q
unQ :: x -> q }
extQ :: ( Typeable a
, Typeable b
)
=> (a -> q)
-> (b -> q)
-> a
-> q
extQ :: forall a b q.
(Typeable a, Typeable b) =>
(a -> q) -> (b -> q) -> a -> q
extQ a -> q
f b -> q
g a
a = q -> (b -> q) -> Maybe b -> q
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (a -> q
f a
a) b -> q
g (a -> Maybe b
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a
a)
ext1Q :: (Data d, Typeable t)
=> (d -> q)
-> (forall e. Data e => t e -> q)
-> d -> q
ext1Q :: forall d (t :: * -> *) q.
(Data d, Typeable t) =>
(d -> q) -> (forall e. Data e => t e -> q) -> d -> q
ext1Q d -> q
def forall e. Data e => t e -> q
ext = Q q d -> d -> q
forall q x. Q q x -> x -> q
unQ (((d -> q) -> Q q d
forall q x. (x -> q) -> Q q x
Q d -> q
def) Q q d -> (forall d. Data d => Q q (t d)) -> Q q d
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
c a -> (forall d. Data d => c (t d)) -> c a
`ext1` ((t d -> q) -> Q q (t d)
forall q x. (x -> q) -> Q q x
Q t d -> q
forall e. Data e => t e -> q
ext))
ext2Q :: (Data d, Typeable t)
=> (d -> q)
-> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q)
-> d -> q
ext2Q :: forall d (t :: * -> * -> *) q.
(Data d, Typeable t) =>
(d -> q)
-> (forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q) -> d -> q
ext2Q d -> q
def forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q
ext = Q q d -> d -> q
forall q x. Q q x -> x -> q
unQ (((d -> q) -> Q q d
forall q x. (x -> q) -> Q q x
Q d -> q
def) Q q d
-> (forall d1 d2. (Data d1, Data d2) => Q q (t d1 d2)) -> Q q d
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
c a -> (forall d1 d2. (Data d1, Data d2) => c (t d1 d2)) -> c a
`ext2` ((t d1 d2 -> q) -> Q q (t d1 d2)
forall q x. (x -> q) -> Q q x
Q t d1 d2 -> q
forall d1 d2. (Data d1, Data d2) => t d1 d2 -> q
ext))
ext1 :: (Data a, Typeable t)
=> c a
-> (forall d. Data d => c (t d))
-> c a
ext1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
c a -> (forall d. Data d => c (t d)) -> c a
ext1 c a
def forall d. Data d => c (t d)
ext = c a -> (c a -> c a) -> Maybe (c a) -> c a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe c a
def c a -> c a
forall a. a -> a
id ((forall d. Data d => c (t d)) -> Maybe (c a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a)
dataCast1 c (t d)
forall d. Data d => c (t d)
ext)
ext2 :: (Data a, Typeable t)
=> c a
-> (forall d1 d2. (Data d1, Data d2) => c (t d1 d2))
-> c a
ext2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
c a -> (forall d1 d2. (Data d1, Data d2) => c (t d1 d2)) -> c a
ext2 c a
def forall d1 d2. (Data d1, Data d2) => c (t d1 d2)
ext = c a -> (c a -> c a) -> Maybe (c a) -> c a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe c a
def c a -> c a
forall a. a -> a
id ((forall d1 d2. (Data d1, Data d2) => c (t d1 d2)) -> Maybe (c a)
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
dataCast2 c (t d e)
forall d1 d2. (Data d1, Data d2) => c (t d1 d2)
ext)