PrintAs.hs revision 0df692ce8b9293499b2e1768458613a63e7b5cd0
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance{- |
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceModule : $Header$
5d801400993c9671010d244646936d8fd435638cChristian MaederCopyright : (c) Christian Maeder and Uni Bremen 2003
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceLicence : All rights reserved.
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceMaintainer : hets@tzi.de
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceStability : experimental
5d801400993c9671010d244646936d8fd435638cChristian MaederPortability : portable
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printing data types of the abstract syntax
aa0ca44e856c87db27e61687cbb630f270976da1Felix Gabriel Mance-}
5d801400993c9671010d244646936d8fd435638cChristian Maeder
5d801400993c9671010d244646936d8fd435638cChristian Maedermodule HasCASL.PrintAs where
5d801400993c9671010d244646936d8fd435638cChristian Maeder
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport HasCASL.As
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Common.Keywords
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Manceimport HasCASL.HToken
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport Common.Lib.Pretty
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maederimport Common.Id
dc8c83e9922e4746c192916565f3522418534f3aFelix Gabriel Manceimport Common.PPUtils
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceimport qualified Common.Lib.Set as Set
feab1106bbee4f2ea2fd48bca7106dd041e4211dFelix Gabriel Manceimport Common.PrettyPrint
18ff56829e5e99383ee6106584d55bcbd8ed45e7Felix Gabriel Manceimport Common.GlobalAnnotations(GlobalAnnos)
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance
b1162cc13e8371724e3382ae6d1cfdeb43891fbbChristian Maeder-- | short cut for: if b then empty else d
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel MancenoPrint :: Bool -> Doc -> Doc
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel MancenoPrint b d = if b then empty else d
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance PrettyPrint TypePattern where
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance printText0 ga (TypePattern name args _) = printText0 ga name
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance <> fcat (map (parens . printText0 ga) args)
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance printText0 ga (TypePatternToken t) = printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (MixfixTypePattern ts) = fsep (map (printText0 ga) ts)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (BracketTypePattern k l _) = bracket k $ commaT_text ga l
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (TypePatternArg t _) = parens $ printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance-- | put proper brackets around a document
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancebracket :: BracketKind -> Doc -> Doc
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mancebracket b t = let (o,c) = getBrackets b in ptext o <> t <> ptext c
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance
0ec1551231bc5dfdcb3f2bd68fec7457fade7bfdFelix Gabriel Mance-- | print a 'Kind' plus a preceding colon (or nothing for 'star')
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceprintKind :: GlobalAnnos -> Kind -> Doc
852bd6145634dc2832b61c44678fe539bc1682d5Christian MaederprintKind ga kind = case kind of
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder ExtClass (Intersection s _) InVar _ ->
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance if Set.isEmpty s then empty else erg
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance _ -> erg
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance where erg = space <> colon <+> printText0 ga kind
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Manceinstance PrettyPrint Type where
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (TypeName name _k _i) = printText0 ga name
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance-- <> printKind ga k
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance-- <> if i == 0 then empty
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance-- else parens (int i)
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maeder printText0 ga (TypeAppl t1 t2) = parens (printText0 ga t1)
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maeder <> parens (printText0 ga t2)
fc7bd98aabe1bc26058660085e8c77d60a97bcecChristian Maeder printText0 ga (TypeToken t) = printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (BracketType k l _) = bracket k $ commaT_text ga l
3c6b4f79cea11dd2acc2060bf1502b6ba9e905f2Felix Gabriel Mance printText0 ga (KindedType t kind _) = (case t of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance FunType _ _ _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ProductType _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance LazyType _ _ -> parens
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder TypeAppl _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance _ -> id) (printText0 ga t)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> colon <+> printText0 ga kind
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (MixfixType ts) = fsep (map (printText0 ga) ts)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (LazyType t _) = text quMark <+> (case t of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance FunType _ _ _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ProductType _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance KindedType _ _ _ -> parens
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance _ -> id) (printText0 ga t)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (ProductType ts _) = if null ts then parens empty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance else fsep (punctuate (space <> text timesS)
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder (map ( \ t ->
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance (case t of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance FunType _ _ _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance ProductType _ _ -> parens
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance _ -> id) $ printText0 ga t) ts))
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (FunType t1 arr t2 _) = (case t1 of
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder FunType _ _ _ _ -> parens
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder _ -> id) (printText0 ga t1)
852bd6145634dc2832b61c44678fe539bc1682d5Christian Maeder <+> printText0 ga arr
ea3f858eb531d981df3ed00beeadd99cf025adecChristian Maeder <+> printText0 ga t2
ea3f858eb531d981df3ed00beeadd99cf025adecChristian Maeder
ea3f858eb531d981df3ed00beeadd99cf025adecChristian Maederinstance PrettyPrint Pred where
75aaf82c430ad2a5cf159962b1c5c09255010fb4Felix Gabriel Mance printText0 ga (IsIn c ts) = if null ts then printText0 ga c
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance else if null $ tail ts then
75aaf82c430ad2a5cf159962b1c5c09255010fb4Felix Gabriel Mance printText0 ga (head ts) <+>
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance colon <+> printText0 ga c
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance else printText0 ga c <+>
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance fsep (punctuate space
1b1144abf7f95a4b23405b8d5604813cfe7b036aFelix Gabriel Mance (map (printText0 ga) ts))
4c684d7a2343be7350eba088f8be42888f86a495Felix Gabriel Mance
1b1144abf7f95a4b23405b8d5604813cfe7b036aFelix Gabriel Manceinstance PrettyPrint t => PrettyPrint (Qual t) where
5a3ae0a9224276de25e709ef8788c1b9716cd206Christian Maeder printText0 ga (ps :=> t) = (if null ps then empty
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance else parens $ commaT_text ga ps <+>
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance ptext implS <+> space) <>
668c9c725a11c0f77057152148570af853a1bc0dFelix Gabriel Mance printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance-- no curried notation for bound variables
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance PrettyPrint TypeScheme where
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (TypeScheme vs t _) = noPrint (null vs) (text forallS
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance <+> semiT_text ga vs
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance <+> text dotS <+> space)
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance <> printText0 ga t
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Manceinstance PrettyPrint Partiality where
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 _ Partial = text quMark
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 _ Total = text exMark
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Manceinstance PrettyPrint Arrow where
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ FunArr = text funS
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ PFunArr = text pFun
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ ContFunArr = text contFun
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ PContFunArr = text pContFun
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Manceinstance PrettyPrint Quantifier where
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ Universal = text forallS
9cb6af1a7632f12b60f592ce5eb2ac51e6bd33bbFelix Gabriel Mance printText0 _ Existential = text existsS
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance printText0 _ Unique = text $ existsS ++ exMark
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance
968930c7674ae3b63d308bf4fa651400aa263054Christian Maederinstance PrettyPrint TypeQual where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 _ OfType = colon
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 _ AsType = text asS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 _ InType = text inS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Manceinstance PrettyPrint Term where
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (QualVar v t _) = parens $ text varS
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> printText0 ga v
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> colon
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (QualOp n t _) = parens $
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance text opS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga n
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> colon
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (ResolvedMixTerm n ts _) = (if isSimpleId n then
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance id else parens) (printText0 ga n)
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <> noPrint (null ts) (parens $ commaT_text ga ts)
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (ApplTerm t1 t2 _) = printText0 ga t1
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> (case t2 of
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance QualVar _ _ _ -> id
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance QualOp _ _ _ -> id
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance TupleTerm _ _ -> id
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance BracketTerm Parens _ _ -> id
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance ResolvedMixTerm _ [] _ -> id
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance TermToken _ -> id
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance _ -> parens) (printText0 ga t2)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (TupleTerm ts _) = parens $ commaT_text ga ts
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (TypedTerm term q typ _) = printText0 ga term
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga q
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga typ
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder printText0 ga (QuantifiedTerm q vs t _) = printText0 ga q
a921ae1da1302f673204e7b63cdce01439a9bd5eFelix Gabriel Mance <+> semiT_text ga vs
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> text dotS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (LambdaTerm ps q t _) = text lamS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> (case ps of
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance [p] -> printText0 ga p
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance _ -> fcat $ map
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance (parens.printText0 ga) ps)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> (case q of
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance Partial -> text dotS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Total -> text $ dotS ++ exMark)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (CaseTerm t es _ ) = text caseS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> text ofS
097bc9f18b722812d480df0f5c634d09cbca8e21Felix Gabriel Mance <+> vcat (punctuate (text " | ")
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance (map (printEq0 ga funS) es))
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (LetTerm es t _) = text letS
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> vcat (punctuate semi
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance (map (printEq0 ga equalS) es))
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> text inS
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (TermToken t) = printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (MixfixTerm ts) = fsep $ map (printText0 ga) ts
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (BracketTerm k l _) = bracket k $ commaT_text ga l
8af00c8930672188ae80c8829428859160d329d0Felix Gabriel Mance
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Manceinstance PrettyPrint Pattern where
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (PatternVar v) = printText0 ga v
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (ResolvedMixPattern n args _) =
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance (if isSimpleId n then id else parens) (printText0 ga n)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <> (case args of
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance [] -> empty
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance [t@(TuplePattern _ _)] ->
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance _ -> parens $ commaT_text ga args)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (PatternConstr n t args _) = printText0 ga n
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> colon
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> printText0 ga t
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> fcat (map (parens.printText0 ga) args)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (PatternToken t) = printText0 ga t
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (BracketPattern k l _) = bracket k $ commaT_text ga l
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance printText0 ga (TuplePattern ps _) = parens $ commaT_text ga ps
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (MixfixPattern ps) = fsep (map (printText0 ga) ps)
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (TypedPattern p t _) = printText0 ga p
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> colon
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance <+> printText0 ga t
c77c0efe19dc6556ac872828bfb4cfc5fbca5ac5Felix Gabriel Mance printText0 ga (AsPattern v p _) = printText0 ga v
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> text asP
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> printText0 ga p
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance-- | print an equation with different symbols between 'Pattern' and 'Term'
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel ManceprintEq0 :: GlobalAnnos -> String -> ProgEq -> Doc
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel ManceprintEq0 ga s (ProgEq p t _) = fsep [printText0 ga p
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Mance , text s
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance , printText0 ga t]
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint VarDecl where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (VarDecl v t _ _) = printText0 ga v <+> colon
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> printText0 ga t
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint GenVarDecl where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (GenVarDecl v) = printText0 ga v
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (GenTypeVarDecl tv) = printText0 ga tv
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint TypeArg where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (TypeArg v c _ _) = printText0 ga v <+> colon
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> printText0 ga c
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint Variance where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ CoVar = text plusS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ ContraVar = text minusS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ InVar = empty
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint Kind where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (ExtClass k v _) = printText0 ga k
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <> printText0 ga v
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (KindAppl k1 k2 _) =
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance (case k1 of
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Mance KindAppl _ _ _ -> parens
6504b297e21d071d8fada2f732cabb6d8f7d38a2Felix Gabriel Mance _ -> id) (printText0 ga k1)
6504b297e21d071d8fada2f732cabb6d8f7d38a2Felix Gabriel Mance <+> text funS
6504b297e21d071d8fada2f732cabb6d8f7d38a2Felix Gabriel Mance <+> printText0 ga k2
6504b297e21d071d8fada2f732cabb6d8f7d38a2Felix Gabriel Mance
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance-- | don't print an empty list and put parens around longer lists
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel ManceprintList0 :: (PrettyPrint a) => GlobalAnnos -> [a] -> Doc
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel ManceprintList0 ga l = case l of
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance [] -> empty
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance [x] -> printText0 ga x
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Mance _ -> parens $ commaT_text ga l
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Mance
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Manceinstance PrettyPrint Class where
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (Downset t) = braces $
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance text "_" <+> text lessS <+> printText0 ga t
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (Intersection c _) = if Set.isEmpty c then ptext "Type"
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance else printList0 ga $ Set.toList c
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Manceinstance PrettyPrint InstOpId where
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (InstOpId n l _) = printText0 ga n
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance <> noPrint (null l)
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance (brackets $ semiT_text ga l)
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance------------------------------------------------------------------------
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance-- item stuff
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance------------------------------------------------------------------------
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance-- | print a 'TypeScheme' as a pseudo type
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel ManceprintPseudoType :: GlobalAnnos -> TypeScheme -> Doc
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel ManceprintPseudoType ga (TypeScheme l t _) = noPrint (null l) (text lamS
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance <+> (if null $ tail l then
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance printText0 ga $ head l
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance else fcat(map (parens . printText0 ga) l))
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance <+> text dotS <> space) <> printText0 ga t
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian Maederinstance PrettyPrint BasicSpec where
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (BasicSpec l) = vcat (map (printText0 ga) l)
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance
511be329b2e8f55d0c6b18bd92571a1776b15932Felix Gabriel Manceinstance PrettyPrint ProgEq where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga = printEq0 ga equalS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint BasicItem where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (SigItems s) = printText0 ga s
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (ProgItems l _) = text programS <+> semiT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (ClassItems i l _) = text classS <+> printText0 ga i
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> semiT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (GenVarItems l _) = text varS <+> semiT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (FreeDatatype l _) = text freeS <+> text typeS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> semiT_text ga l
44985cbd4eb61dbc348617ebdd44a774e51dac07Christian Maeder printText0 ga (GenItems l _) = text generatedS <+> braces (semiT_text ga l)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (AxiomItems vs fs _) = (if null vs then empty
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance else text forallS <+> semiT_text ga vs)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance $$ vcat (map
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance (\x -> text dotS <+> printText0 ga x)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance fs)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint SigItems where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (TypeItems i l _) = text typeS <+> printText0 ga i
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> semiT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (OpItems l _) = text opS <+> semiT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint Instance where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ Instance = text instanceS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ _ = empty
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint ClassItem where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (ClassItem d l _) = printText0 ga d $$
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance if null l then empty
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance else braces (semiT_text ga l)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Manceinstance PrettyPrint ClassDecl where
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance printText0 ga (ClassDecl l k _) = commaT_text ga l <> printKind ga k
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance printText0 ga (SubclassDecl l k s _) = commaT_text ga l
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <> printKind ga k
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> text lessS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> printText0 ga s
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (ClassDefn n k c _) = printText0 ga n
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <> printKind ga k
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <+> text equalS
6504b297e21d071d8fada2f732cabb6d8f7d38a2Felix Gabriel Mance <+> printText0 ga c
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (DownsetDefn c v t _) =
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance let pv = printText0 ga v in
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga c
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <> text equalS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance <> braces (pv <> text dotS <> pv
83f5f3291f9b40fa688776b4da10b5fa102a5ff8Felix Gabriel Mance <> text lessS
83f5f3291f9b40fa688776b4da10b5fa102a5ff8Felix Gabriel Mance <+> printText0 ga t)
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint Vars where
fa544036407a8ec4be203ebd5e3bff225175e664Felix Gabriel Mance printText0 ga (Var v) = printText0 ga v
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (VarTuple vs _) = parens $ commaT_text ga vs
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Manceinstance PrettyPrint TypeItem where
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (TypeDecl l k _) = commaT_text ga l <>
fa544036407a8ec4be203ebd5e3bff225175e664Felix Gabriel Mance printKind ga k
fa544036407a8ec4be203ebd5e3bff225175e664Felix Gabriel Mance printText0 ga (SubtypeDecl l t _) = commaT_text ga l <+> text lessS
83f5f3291f9b40fa688776b4da10b5fa102a5ff8Felix Gabriel Mance <+> printText0 ga t
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (IsoDecl l _) = cat(punctuate (text " = ")
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance (map (printText0 ga) l))
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 ga (SubtypeDefn p v t f _) = printText0 ga p
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> text equalS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> braces (printText0 ga v
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> colon
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> text dotS
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance <+> printText0 ga f)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (AliasType p k t _) = (printText0 ga p <>
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance case k of
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Nothing -> empty
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance Just j -> space <> colon <+>
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga j)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> text assignS
968930c7674ae3b63d308bf4fa651400aa263054Christian Maeder <+> printPseudoType ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (Datatype t) = printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Manceinstance PrettyPrint OpItem where
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance printText0 ga (OpDecl l t as _) = commaT_text ga l <+> colon
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> (printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <> (if null as then empty else comma)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <> commaT_text ga as)
1b90322eaf59ded3de24fc891bd67bbd73ec2bfaFelix Gabriel Mance printText0 ga (OpDefn n ps s p t _) = (printText0 ga n
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <> fcat (map (printText0 ga) ps))
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> (colon <> if p == Partial
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance then text quMark else empty)
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> printText0 ga s
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> text equalS
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance <+> printText0 ga t
c298a419605037f5352b5ad0f67b3e06db094051Felix Gabriel Mance
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Manceinstance PrettyPrint BinOpAttr where
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance printText0 _ Assoc = text assocS
4b7c9b9fec53befb553f2c9b11e30a4fe2235e03Felix Gabriel Mance printText0 _ Comm = text commS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance printText0 _ Idem = text idemS
863fa65ac095659c6da1cde7fe7b839f1e7f60f9Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Manceinstance PrettyPrint OpAttr where
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (BinOpAttr a _) = printText0 ga a
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (UnitOpAttr t _) = text unitS <+> printText0 ga t
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Manceinstance PrettyPrint DatatypeDecl where
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (DatatypeDecl p k as d _) = (printText0 ga p <>
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printKind ga k)
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> text defnS
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> vcat(punctuate (text " | ")
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance (map (printText0 ga) as))
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> case d of Nothing -> empty
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance Just c -> text derivingS
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance <+> printText0 ga c
ffa6044b04fa0e31242141ff56a5d80c4233b676Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Manceinstance PrettyPrint Alternative where
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (Constructor n cs p _) = printText0 ga n
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> fsep (map (printText0 ga) cs)
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> (case p of {Partial -> text quMark;
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance _ -> empty})
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (Subtype l _) = text typeS <+> commaT_text ga l
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Manceinstance PrettyPrint Components where
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (Selector n p t _ _) = printText0 ga n
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <> colon <> (case p of { Partial ->text quMark;
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance _ -> empty }
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> printText0 ga t)
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (NoSelector t) = printText0 ga t
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (NestedComponents l _) = parens $ semiT_text ga l
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Manceinstance PrettyPrint OpId where
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance printText0 ga (OpId n ts _) = printText0 ga n
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance <+> noPrint (null ts)
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance (brackets $ commaT_text ga ts)
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance
e99c3c1f572d0442872bba58f187ca520ef5d040Felix Gabriel Mance