Pragmas refactoring. Also adds RULES and 'SPECIALIZE instance' support.
[ghc.git] / libraries / template-haskell / Language / Haskell / TH / Ppr.hs
1 -- | contains a prettyprinter for the
2 -- Template Haskell datatypes
3
4 module Language.Haskell.TH.Ppr where
5 -- All of the exports from this module should
6 -- be "public" functions. The main module TH
7 -- re-exports them all.
8
9 import Text.PrettyPrint (render)
10 import Language.Haskell.TH.PprLib
11 import Language.Haskell.TH.Syntax
12 import Data.Word ( Word8 )
13 import Data.Char ( toLower, chr )
14 import GHC.Show ( showMultiLineString )
15
16 nestDepth :: Int
17 nestDepth = 4
18
19 type Precedence = Int
20 appPrec, unopPrec, opPrec, noPrec :: Precedence
21 appPrec = 3 -- Argument of a function application
22 opPrec = 2 -- Argument of an infix operator
23 unopPrec = 1 -- Argument of an unresolved infix operator
24 noPrec = 0 -- Others
25
26 parensIf :: Bool -> Doc -> Doc
27 parensIf True d = parens d
28 parensIf False d = d
29
30 ------------------------------
31
32 pprint :: Ppr a => a -> String
33 pprint x = render $ to_HPJ_Doc $ ppr x
34
35 class Ppr a where
36 ppr :: a -> Doc
37 ppr_list :: [a] -> Doc
38 ppr_list = vcat . map ppr
39
40 instance Ppr a => Ppr [a] where
41 ppr x = ppr_list x
42
43 ------------------------------
44 instance Ppr Name where
45 ppr v = pprName v
46
47 ------------------------------
48 instance Ppr Info where
49 ppr (TyConI d) = ppr d
50 ppr (ClassI d is) = ppr d $$ vcat (map ppr is)
51 ppr (FamilyI d is) = ppr d $$ vcat (map ppr is)
52 ppr (PrimTyConI name arity is_unlifted)
53 = text "Primitive"
54 <+> (if is_unlifted then text "unlifted" else empty)
55 <+> text "type construtor" <+> quotes (ppr name)
56 <+> parens (text "arity" <+> int arity)
57 ppr (ClassOpI v ty cls fix)
58 = text "Class op from" <+> ppr cls <> colon <+>
59 vcat [ppr_sig v ty, pprFixity v fix]
60 ppr (DataConI v ty tc fix)
61 = text "Constructor from" <+> ppr tc <> colon <+>
62 vcat [ppr_sig v ty, pprFixity v fix]
63 ppr (TyVarI v ty)
64 = text "Type variable" <+> ppr v <+> equals <+> ppr ty
65 ppr (VarI v ty mb_d fix)
66 = vcat [ppr_sig v ty, pprFixity v fix,
67 case mb_d of { Nothing -> empty; Just d -> ppr d }]
68
69 ppr_sig :: Name -> Type -> Doc
70 ppr_sig v ty = ppr v <+> text "::" <+> ppr ty
71
72 pprFixity :: Name -> Fixity -> Doc
73 pprFixity _ f | f == defaultFixity = empty
74 pprFixity v (Fixity i d) = ppr_fix d <+> int i <+> ppr v
75 where ppr_fix InfixR = text "infixr"
76 ppr_fix InfixL = text "infixl"
77 ppr_fix InfixN = text "infix"
78
79
80 ------------------------------
81 instance Ppr Exp where
82 ppr = pprExp noPrec
83
84 pprInfixExp :: Exp -> Doc
85 pprInfixExp (VarE v) = pprName' Infix v
86 pprInfixExp (ConE v) = pprName' Infix v
87 pprInfixExp _ = error "Attempt to pretty-print non-variable or constructor in infix context!"
88
89 pprExp :: Precedence -> Exp -> Doc
90 pprExp _ (VarE v) = pprName' Applied v
91 pprExp _ (ConE c) = pprName' Applied c
92 pprExp i (LitE l) = pprLit i l
93 pprExp i (AppE e1 e2) = parensIf (i >= appPrec) $ pprExp opPrec e1
94 <+> pprExp appPrec e2
95 pprExp _ (ParensE e) = parens (pprExp noPrec e)
96 pprExp i (UInfixE e1 op e2)
97 = parensIf (i > unopPrec) $ pprExp unopPrec e1
98 <+> pprInfixExp op
99 <+> pprExp unopPrec e2
100 pprExp i (InfixE (Just e1) op (Just e2))
101 = parensIf (i >= opPrec) $ pprExp opPrec e1
102 <+> pprInfixExp op
103 <+> pprExp opPrec e2
104 pprExp _ (InfixE me1 op me2) = parens $ pprMaybeExp noPrec me1
105 <+> pprInfixExp op
106 <+> pprMaybeExp noPrec me2
107 pprExp i (LamE ps e) = parensIf (i > noPrec) $ char '\\' <> hsep (map (pprPat appPrec) ps)
108 <+> text "->" <+> ppr e
109 pprExp i (LamCaseE ms) = parensIf (i > noPrec)
110 $ text "\\case" $$ nest nestDepth (ppr ms)
111 pprExp _ (TupE es) = parens $ sep $ punctuate comma $ map ppr es
112 pprExp _ (UnboxedTupE es) = hashParens $ sep $ punctuate comma $ map ppr es
113 -- Nesting in Cond is to avoid potential problems in do statments
114 pprExp i (CondE guard true false)
115 = parensIf (i > noPrec) $ sep [text "if" <+> ppr guard,
116 nest 1 $ text "then" <+> ppr true,
117 nest 1 $ text "else" <+> ppr false]
118 pprExp i (MultiIfE alts)
119 = parensIf (i > noPrec) $ vcat $
120 case alts of
121 [] -> [text "if {}"]
122 (alt : alts') -> text "if" <+> pprGuarded arrow alt
123 : map (nest 3 . pprGuarded arrow) alts'
124 pprExp i (LetE ds e) = parensIf (i > noPrec) $ text "let" <+> ppr ds
125 $$ text " in" <+> ppr e
126 pprExp i (CaseE e ms)
127 = parensIf (i > noPrec) $ text "case" <+> ppr e <+> text "of"
128 $$ nest nestDepth (ppr ms)
129 pprExp i (DoE ss) = parensIf (i > noPrec) $ text "do" <+> ppr ss
130 pprExp _ (CompE []) = error "Can't happen: pprExp (CompExp [])"
131 -- This will probably break with fixity declarations - would need a ';'
132 pprExp _ (CompE ss) = text "[" <> ppr s
133 <+> text "|"
134 <+> (sep $ punctuate comma $ map ppr ss')
135 <> text "]"
136 where s = last ss
137 ss' = init ss
138 pprExp _ (ArithSeqE d) = ppr d
139 pprExp _ (ListE es) = brackets $ sep $ punctuate comma $ map ppr es
140 pprExp i (SigE e t) = parensIf (i > noPrec) $ ppr e <+> text "::" <+> ppr t
141 pprExp _ (RecConE nm fs) = ppr nm <> braces (pprFields fs)
142 pprExp _ (RecUpdE e fs) = pprExp appPrec e <> braces (pprFields fs)
143
144 pprFields :: [(Name,Exp)] -> Doc
145 pprFields = sep . punctuate comma . map (\(s,e) -> ppr s <+> equals <+> ppr e)
146
147 pprMaybeExp :: Precedence -> Maybe Exp -> Doc
148 pprMaybeExp _ Nothing = empty
149 pprMaybeExp i (Just e) = pprExp i e
150
151 ------------------------------
152 instance Ppr Stmt where
153 ppr (BindS p e) = ppr p <+> text "<-" <+> ppr e
154 ppr (LetS ds) = text "let" <+> ppr ds
155 ppr (NoBindS e) = ppr e
156 ppr (ParS sss) = sep $ punctuate (text "|")
157 $ map (sep . punctuate comma . map ppr) sss
158
159 ------------------------------
160 instance Ppr Match where
161 ppr (Match p rhs ds) = ppr p <+> pprBody False rhs
162 $$ where_clause ds
163
164 ------------------------------
165 pprGuarded :: Doc -> (Guard, Exp) -> Doc
166 pprGuarded eqDoc (guard, expr) = case guard of
167 NormalG guardExpr -> char '|' <+> ppr guardExpr <+> eqDoc <+> ppr expr
168 PatG stmts -> char '|' <+> vcat (punctuate comma $ map ppr stmts) $$
169 nest nestDepth (eqDoc <+> ppr expr)
170
171 ------------------------------
172 pprBody :: Bool -> Body -> Doc
173 pprBody eq body = case body of
174 GuardedB xs -> nest nestDepth $ vcat $ map (pprGuarded eqDoc) xs
175 NormalB e -> eqDoc <+> ppr e
176 where eqDoc | eq = equals
177 | otherwise = arrow
178
179 ------------------------------
180 pprLit :: Precedence -> Lit -> Doc
181 pprLit i (IntPrimL x) = parensIf (i > noPrec && x < 0)
182 (integer x <> char '#')
183 pprLit _ (WordPrimL x) = integer x <> text "##"
184 pprLit i (FloatPrimL x) = parensIf (i > noPrec && x < 0)
185 (float (fromRational x) <> char '#')
186 pprLit i (DoublePrimL x) = parensIf (i > noPrec && x < 0)
187 (double (fromRational x) <> text "##")
188 pprLit i (IntegerL x) = parensIf (i > noPrec && x < 0) (integer x)
189 pprLit _ (CharL c) = text (show c)
190 pprLit _ (StringL s) = pprString s
191 pprLit _ (StringPrimL s) = pprString (bytesToString s) <> char '#'
192 pprLit i (RationalL rat) = parensIf (i > noPrec) $ rational rat
193
194 bytesToString :: [Word8] -> String
195 bytesToString = map (chr . fromIntegral)
196
197 pprString :: String -> Doc
198 -- Print newlines as newlines with Haskell string escape notation,
199 -- not as '\n'. For other non-printables use regular escape notation.
200 pprString s = vcat (map text (showMultiLineString s))
201
202 ------------------------------
203 instance Ppr Pat where
204 ppr = pprPat noPrec
205
206 pprPat :: Precedence -> Pat -> Doc
207 pprPat i (LitP l) = pprLit i l
208 pprPat _ (VarP v) = pprName' Applied v
209 pprPat _ (TupP ps) = parens $ sep $ punctuate comma $ map ppr ps
210 pprPat _ (UnboxedTupP ps) = hashParens $ sep $ punctuate comma $ map ppr ps
211 pprPat i (ConP s ps) = parensIf (i >= appPrec) $ pprName' Applied s
212 <+> sep (map (pprPat appPrec) ps)
213 pprPat _ (ParensP p) = parens $ pprPat noPrec p
214 pprPat i (UInfixP p1 n p2)
215 = parensIf (i > unopPrec) (pprPat unopPrec p1 <+>
216 pprName' Infix n <+>
217 pprPat unopPrec p2)
218 pprPat i (InfixP p1 n p2)
219 = parensIf (i >= opPrec) (pprPat opPrec p1 <+>
220 pprName' Infix n <+>
221 pprPat opPrec p2)
222 pprPat i (TildeP p) = parensIf (i > noPrec) $ char '~' <> pprPat appPrec p
223 pprPat i (BangP p) = parensIf (i > noPrec) $ char '!' <> pprPat appPrec p
224 pprPat i (AsP v p) = parensIf (i > noPrec) $ ppr v <> text "@"
225 <> pprPat appPrec p
226 pprPat _ WildP = text "_"
227 pprPat _ (RecP nm fs)
228 = parens $ ppr nm
229 <+> braces (sep $ punctuate comma $
230 map (\(s,p) -> ppr s <+> equals <+> ppr p) fs)
231 pprPat _ (ListP ps) = brackets $ sep $ punctuate comma $ map ppr ps
232 pprPat i (SigP p t) = parensIf (i > noPrec) $ ppr p <+> text "::" <+> ppr t
233 pprPat _ (ViewP e p) = parens $ pprExp noPrec e <+> text "->" <+> pprPat noPrec p
234
235 ------------------------------
236 instance Ppr Dec where
237 ppr = ppr_dec True
238
239 ppr_dec :: Bool -- declaration on the toplevel?
240 -> Dec
241 -> Doc
242 ppr_dec _ (FunD f cs) = vcat $ map (\c -> ppr f <+> ppr c) cs
243 ppr_dec _ (ValD p r ds) = ppr p <+> pprBody True r
244 $$ where_clause ds
245 ppr_dec _ (TySynD t xs rhs)
246 = ppr_tySyn empty t (hsep (map ppr xs)) rhs
247 ppr_dec _ (DataD ctxt t xs cs decs)
248 = ppr_data empty ctxt t (hsep (map ppr xs)) cs decs
249 ppr_dec _ (NewtypeD ctxt t xs c decs)
250 = ppr_newtype empty ctxt t (sep (map ppr xs)) c decs
251 ppr_dec _ (ClassD ctxt c xs fds ds)
252 = text "class" <+> pprCxt ctxt <+> ppr c <+> hsep (map ppr xs) <+> ppr fds
253 $$ where_clause ds
254 ppr_dec _ (InstanceD ctxt i ds) = text "instance" <+> pprCxt ctxt <+> ppr i
255 $$ where_clause ds
256 ppr_dec _ (SigD f t) = ppr f <+> text "::" <+> ppr t
257 ppr_dec _ (ForeignD f) = ppr f
258 ppr_dec _ (InfixD fx n) = pprFixity n fx
259 ppr_dec _ (PragmaD p) = ppr p
260 ppr_dec isTop (FamilyD flav tc tvs k)
261 = ppr flav <+> maybeFamily <+> ppr tc <+> hsep (map ppr tvs) <+> maybeKind
262 where
263 maybeFamily | isTop = text "family"
264 | otherwise = empty
265
266 maybeKind | (Just k') <- k = text "::" <+> ppr k'
267 | otherwise = empty
268 ppr_dec isTop (DataInstD ctxt tc tys cs decs)
269 = ppr_data maybeInst ctxt tc (sep (map pprParendType tys)) cs decs
270 where
271 maybeInst | isTop = text "instance"
272 | otherwise = empty
273 ppr_dec isTop (NewtypeInstD ctxt tc tys c decs)
274 = ppr_newtype maybeInst ctxt tc (sep (map pprParendType tys)) c decs
275 where
276 maybeInst | isTop = text "instance"
277 | otherwise = empty
278 ppr_dec isTop (TySynInstD tc tys rhs)
279 = ppr_tySyn maybeInst tc (sep (map pprParendType tys)) rhs
280 where
281 maybeInst | isTop = text "instance"
282 | otherwise = empty
283
284 ppr_data :: Doc -> Cxt -> Name -> Doc -> [Con] -> [Name] -> Doc
285 ppr_data maybeInst ctxt t argsDoc cs decs
286 = sep [text "data" <+> maybeInst
287 <+> pprCxt ctxt
288 <+> ppr t <+> argsDoc,
289 nest nestDepth (sep (pref $ map ppr cs)),
290 if null decs
291 then empty
292 else nest nestDepth
293 $ text "deriving"
294 <+> parens (hsep $ punctuate comma $ map ppr decs)]
295 where
296 pref :: [Doc] -> [Doc]
297 pref [] = [] -- No constructors; can't happen in H98
298 pref (d:ds) = (char '=' <+> d):map (char '|' <+>) ds
299
300 ppr_newtype :: Doc -> Cxt -> Name -> Doc -> Con -> [Name] -> Doc
301 ppr_newtype maybeInst ctxt t argsDoc c decs
302 = sep [text "newtype" <+> maybeInst
303 <+> pprCxt ctxt
304 <+> ppr t <+> argsDoc,
305 nest 2 (char '=' <+> ppr c),
306 if null decs
307 then empty
308 else nest nestDepth
309 $ text "deriving"
310 <+> parens (hsep $ punctuate comma $ map ppr decs)]
311
312 ppr_tySyn :: Doc -> Name -> Doc -> Type -> Doc
313 ppr_tySyn maybeInst t argsDoc rhs
314 = text "type" <+> maybeInst <+> ppr t <+> argsDoc <+> text "=" <+> ppr rhs
315
316 ------------------------------
317 instance Ppr FunDep where
318 ppr (FunDep xs ys) = hsep (map ppr xs) <+> text "->" <+> hsep (map ppr ys)
319 ppr_list [] = empty
320 ppr_list xs = char '|' <+> sep (punctuate (text ", ") (map ppr xs))
321
322 ------------------------------
323 instance Ppr FamFlavour where
324 ppr DataFam = text "data"
325 ppr TypeFam = text "type"
326
327 ------------------------------
328 instance Ppr Foreign where
329 ppr (ImportF callconv safety impent as typ)
330 = text "foreign import"
331 <+> showtextl callconv
332 <+> showtextl safety
333 <+> text (show impent)
334 <+> ppr as
335 <+> text "::" <+> ppr typ
336 ppr (ExportF callconv expent as typ)
337 = text "foreign export"
338 <+> showtextl callconv
339 <+> text (show expent)
340 <+> ppr as
341 <+> text "::" <+> ppr typ
342
343 ------------------------------
344 instance Ppr Pragma where
345 ppr (InlineP n inline rm phases)
346 = text "{-#"
347 <+> ppr inline
348 <+> ppr rm
349 <+> ppr phases
350 <+> ppr n
351 <+> text "#-}"
352 ppr (SpecialiseP n ty inline phases)
353 = text "{-# SPECIALISE"
354 <+> maybe empty ppr inline
355 <+> ppr phases
356 <+> sep [ ppr n <+> text "::"
357 , nest 2 $ ppr ty ]
358 <+> text "#-}"
359 ppr (SpecialiseInstP inst)
360 = text "{-# SPECIALISE instance" <+> ppr inst <+> text "#-}"
361 ppr (RuleP n bndrs lhs rhs phases)
362 = sep [ text "{-# RULES" <+> pprString n <+> ppr phases
363 , nest 4 $ ppr_forall <+> ppr lhs
364 , nest 4 $ char '=' <+> ppr rhs <+> text "#-}" ]
365 where ppr_forall | null bndrs = empty
366 | otherwise = text "forall"
367 <+> fsep (map ppr bndrs)
368 <+> char '.'
369
370 ------------------------------
371 instance Ppr Inline where
372 ppr NoInline = text "NOINLINE"
373 ppr Inline = text "INLINE"
374 ppr Inlinable = text "INLINABLE"
375
376 ------------------------------
377 instance Ppr RuleMatch where
378 ppr ConLike = text "CONLIKE"
379 ppr FunLike = empty
380
381 ------------------------------
382 instance Ppr Phases where
383 ppr AllPhases = empty
384 ppr (FromPhase i) = brackets $ int i
385 ppr (BeforePhase i) = brackets $ char '~' <> int i
386
387 ------------------------------
388 instance Ppr RuleBndr where
389 ppr (RuleVar n) = ppr n
390 ppr (TypedRuleVar n ty) = parens $ ppr n <+> text "::" <+> ppr ty
391
392 ------------------------------
393 instance Ppr Clause where
394 ppr (Clause ps rhs ds) = hsep (map (pprPat appPrec) ps) <+> pprBody True rhs
395 $$ where_clause ds
396
397 ------------------------------
398 instance Ppr Con where
399 ppr (NormalC c sts) = ppr c <+> sep (map pprStrictType sts)
400 ppr (RecC c vsts)
401 = ppr c <+> braces (sep (punctuate comma $ map pprVarStrictType vsts))
402 ppr (InfixC st1 c st2) = pprStrictType st1
403 <+> pprName' Infix c
404 <+> pprStrictType st2
405 ppr (ForallC ns ctxt con) = text "forall" <+> hsep (map ppr ns)
406 <+> char '.' <+> sep [pprCxt ctxt, ppr con]
407
408 ------------------------------
409 pprVarStrictType :: (Name, Strict, Type) -> Doc
410 -- Slight infelicity: with print non-atomic type with parens
411 pprVarStrictType (v, str, t) = ppr v <+> text "::" <+> pprStrictType (str, t)
412
413 ------------------------------
414 pprStrictType :: (Strict, Type) -> Doc
415 -- Prints with parens if not already atomic
416 pprStrictType (IsStrict, t) = char '!' <> pprParendType t
417 pprStrictType (NotStrict, t) = pprParendType t
418 pprStrictType (Unpacked, t) = text "{-# UNPACK #-} !" <> pprParendType t
419
420 ------------------------------
421 pprParendType :: Type -> Doc
422 pprParendType (VarT v) = ppr v
423 pprParendType (ConT c) = ppr c
424 pprParendType (TupleT 0) = text "()"
425 pprParendType (TupleT n) = parens (hcat (replicate (n-1) comma))
426 pprParendType (UnboxedTupleT n) = hashParens $ hcat $ replicate (n-1) comma
427 pprParendType ArrowT = parens (text "->")
428 pprParendType ListT = text "[]"
429 pprParendType (LitT l) = pprTyLit l
430 pprParendType (PromotedT c) = text "'" <> ppr c
431 pprParendType (PromotedTupleT 0) = text "'()"
432 pprParendType (PromotedTupleT n) = quoteParens (hcat (replicate (n-1) comma))
433 pprParendType PromotedNilT = text "'[]"
434 pprParendType PromotedConsT = text "(':)"
435 pprParendType StarT = char '*'
436 pprParendType ConstraintT = text "Constraint"
437 pprParendType other = parens (ppr other)
438
439 instance Ppr Type where
440 ppr (ForallT tvars ctxt ty)
441 = text "forall" <+> hsep (map ppr tvars) <+> text "."
442 <+> sep [pprCxt ctxt, ppr ty]
443 ppr (SigT ty k) = ppr ty <+> text "::" <+> ppr k
444 ppr ty = pprTyApp (split ty)
445
446 pprTyApp :: (Type, [Type]) -> Doc
447 pprTyApp (ArrowT, [arg1,arg2]) = sep [pprFunArgType arg1 <+> text "->", ppr arg2]
448 pprTyApp (ListT, [arg]) = brackets (ppr arg)
449 pprTyApp (TupleT n, args)
450 | length args == n = parens (sep (punctuate comma (map ppr args)))
451 pprTyApp (PromotedTupleT n, args)
452 | length args == n = quoteParens (sep (punctuate comma (map ppr args)))
453 pprTyApp (fun, args) = pprParendType fun <+> sep (map pprParendType args)
454
455 pprFunArgType :: Type -> Doc -- Should really use a precedence argument
456 -- Everything except forall and (->) binds more tightly than (->)
457 pprFunArgType ty@(ForallT {}) = parens (ppr ty)
458 pprFunArgType ty@((ArrowT `AppT` _) `AppT` _) = parens (ppr ty)
459 pprFunArgType ty@(SigT _ _) = parens (ppr ty)
460 pprFunArgType ty = ppr ty
461
462 split :: Type -> (Type, [Type]) -- Split into function and args
463 split t = go t []
464 where go (AppT t1 t2) args = go t1 (t2:args)
465 go ty args = (ty, args)
466
467 pprTyLit :: TyLit -> Doc
468 pprTyLit (NumTyLit n) = integer n
469 pprTyLit (StrTyLit s) = text (show s)
470
471 instance Ppr TyLit where
472 ppr = pprTyLit
473
474 ------------------------------
475 instance Ppr TyVarBndr where
476 ppr (PlainTV nm) = ppr nm
477 ppr (KindedTV nm k) = parens (ppr nm <+> text "::" <+> ppr k)
478
479 ------------------------------
480 pprCxt :: Cxt -> Doc
481 pprCxt [] = empty
482 pprCxt [t] = ppr t <+> text "=>"
483 pprCxt ts = parens (sep $ punctuate comma $ map ppr ts) <+> text "=>"
484
485 ------------------------------
486 instance Ppr Pred where
487 ppr (ClassP cla tys) = ppr cla <+> sep (map pprParendType tys)
488 ppr (EqualP ty1 ty2) = pprFunArgType ty1 <+> char '~' <+> pprFunArgType ty2
489
490 ------------------------------
491 instance Ppr Range where
492 ppr = brackets . pprRange
493 where pprRange :: Range -> Doc
494 pprRange (FromR e) = ppr e <> text ".."
495 pprRange (FromThenR e1 e2) = ppr e1 <> text ","
496 <> ppr e2 <> text ".."
497 pprRange (FromToR e1 e2) = ppr e1 <> text ".." <> ppr e2
498 pprRange (FromThenToR e1 e2 e3) = ppr e1 <> text ","
499 <> ppr e2 <> text ".."
500 <> ppr e3
501
502 ------------------------------
503 where_clause :: [Dec] -> Doc
504 where_clause [] = empty
505 where_clause ds = nest nestDepth $ text "where" <+> vcat (map (ppr_dec False) ds)
506
507 showtextl :: Show a => a -> Doc
508 showtextl = text . map toLower . show
509
510 hashParens :: Doc -> Doc
511 hashParens d = text "(# " <> d <> text " #)"
512
513 quoteParens :: Doc -> Doc
514 quoteParens d = text "'(" <> d <> text ")"
515