2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
4 \section[HsDecls]{Abstract syntax: global declarations}
6 Definitions for: @TyDecl@ and @ConDecl@, @ClassDecl@,
7 @InstDecl@, @DefaultDecl@ and @ForeignDecl@.
11 HsDecl(..), TyClDecl(..), InstDecl(..), RuleDecl(..), RuleBndr(..),
12 DefaultDecl(..), ForeignDecl(..), ForKind(..),
13 ExtName(..), isDynamicExtName, extNameStatic,
14 ConDecl(..), ConDetails(..),
15 BangType(..), getBangType,
16 DeprecDecl(..), DeprecTxt,
17 hsDeclName, instDeclName, tyClDeclName, tyClDeclNames, tyClDeclSysNames,
18 isClassDecl, isSynDecl, isDataDecl, isIfaceSigDecl, countTyClDecls,
19 mkClassDeclSysNames, isIfaceRuleDecl, ifaceRuleDeclName,
20 getClassDeclSysNames, conDetailsTys
23 #include "HsVersions.h"
26 import HsBinds ( HsBinds, MonoBinds, Sig(..), FixitySig(..) )
27 import HsExpr ( HsExpr )
29 import PprCore ( pprCoreRule )
30 import HsCore ( UfExpr, UfBinder, HsIdInfo, pprHsIdInfo,
31 eq_ufBinders, eq_ufExpr, pprUfExpr
33 import CoreSyn ( CoreRule(..) )
34 import BasicTypes ( NewOrData(..) )
35 import CallConv ( CallConv, pprCallConv )
38 import Name ( NamedThing )
39 import FunDeps ( pprFundeps )
40 import Class ( FunDep, DefMeth(..) )
41 import CStrings ( CLabelString, pprCLabelString )
43 import SrcLoc ( SrcLoc )
47 %************************************************************************
49 \subsection[HsDecl]{Declarations}
51 %************************************************************************
55 = TyClD (TyClDecl name pat)
56 | InstD (InstDecl name pat)
57 | DefD (DefaultDecl name)
58 | ValD (HsBinds name pat)
59 | ForD (ForeignDecl name)
60 | FixD (FixitySig name)
61 | DeprecD (DeprecDecl name)
62 | RuleD (RuleDecl name pat)
64 -- NB: all top-level fixity decls are contained EITHER
66 -- OR in the ClassDecls in TyClDs
69 -- a) data constructors
70 -- b) class methods (but they can be also done in the
71 -- signatures of class decls)
72 -- c) imported functions (that have an IfacSig)
75 -- The latter is for class methods only
80 hsDeclName :: (NamedThing name, Outputable name, Outputable pat)
81 => HsDecl name pat -> name
83 hsDeclName (TyClD decl) = tyClDeclName decl
84 hsDeclName (InstD decl) = instDeclName decl
85 hsDeclName (ForD (ForeignDecl name _ _ _ _ _)) = name
86 hsDeclName (FixD (FixitySig name _ _)) = name
87 -- Others don't make sense
89 hsDeclName x = pprPanic "HsDecls.hsDeclName" (ppr x)
93 instDeclName :: InstDecl name pat -> name
94 instDeclName (InstDecl _ _ _ (Just name) _) = name
99 instance (NamedThing name, Outputable name, Outputable pat)
100 => Outputable (HsDecl name pat) where
102 ppr (TyClD dcl) = ppr dcl
103 ppr (ValD binds) = ppr binds
104 ppr (DefD def) = ppr def
105 ppr (InstD inst) = ppr inst
106 ppr (ForD fd) = ppr fd
107 ppr (FixD fd) = ppr fd
108 ppr (RuleD rd) = ppr rd
109 ppr (DeprecD dd) = ppr dd
113 %************************************************************************
115 \subsection[TyDecl]{@data@, @newtype@ or @type@ (synonym) type declaration}
117 %************************************************************************
119 Type and class declarations carry 'implicit names'. In particular:
123 Each data type decl defines
124 a worker name for each constructor
125 to-T and from-T convertors
126 Each class decl defines
127 a tycon for the class
128 a data constructor for that tycon
129 the worker for that constructor
130 a selector for each superclass
132 All have occurrence names that are derived uniquely from their parent declaration.
134 None of these get separate definitions in an interface file; they are
135 fully defined by the data or class decl. But they may *occur* in
136 interface files, of course. Any such occurrence must haul in the
137 relevant type or class decl.
140 - Make up their occurrence names immediately
142 - Ensure they "point to" the parent data/class decl
143 when loading that decl from an interface file
145 - When renaming the decl look them up in the name cache,
146 ensure correct module and provenance is set
148 Type B: Default methods and dictionary functions
149 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150 Have their own binding in an interface file.
152 Default methods : occurrence name is derived uniquely from the class decl.
153 Dict functions : occurrence name is derived from the instance decl, plus a unique number.
156 - Do *not* make them point to the parent class decl
157 - Interface-file decls: treat just like Type A
158 - Source-file decls: the names aren't in the decl at all;
159 instead the typechecker makes them up
162 data TyClDecl name pat
163 = IfaceSig name -- It may seem odd to classify an interface-file signature
164 (HsType name) -- as a 'TyClDecl', but it's very convenient. These three
165 [HsIdInfo name] -- are the kind that appear in interface files.
169 (HsContext name) -- context
170 name -- type constructor
171 [HsTyVarBndr name] -- type variables
172 [ConDecl name] -- data constructors (empty if abstract)
173 Int -- Number of data constructors (valid even if type is abstract)
174 (Maybe [name]) -- derivings; Nothing => not specified
175 -- (i.e., derive default); Just [] => derive
176 -- *nothing*; Just <list> => as you would
179 name -- generic converter functions
180 name -- generic converter functions
182 | TySynonym name -- type constructor
183 [HsTyVarBndr name] -- type variables
184 (HsType name) -- synonym expansion
187 | ClassDecl (HsContext name) -- context...
188 name -- name of the class
189 [HsTyVarBndr name] -- the class type variables
190 [FunDep name] -- functional dependencies
191 [Sig name] -- methods' signatures
192 (MonoBinds name pat) -- default methods
193 (ClassDeclSysNames name)
200 isIfaceSigDecl, isDataDecl, isSynDecl, isClassDecl :: TyClDecl name pat -> Bool
202 isIfaceSigDecl (IfaceSig _ _ _ _) = True
203 isIfaceSigDecl other = False
205 isSynDecl (TySynonym _ _ _ _) = True
206 isSynDecl other = False
208 isDataDecl (TyData _ _ _ _ _ _ _ _ _ _) = True
209 isDataDecl other = False
211 isClassDecl (ClassDecl _ _ _ _ _ _ _ _ ) = True
212 isClassDecl other = False
218 --------------------------------
219 tyClDeclName :: TyClDecl name pat -> name
220 tyClDeclName (IfaceSig name _ _ _) = name
221 tyClDeclName (TyData _ _ name _ _ _ _ _ _ _) = name
222 tyClDeclName (TySynonym name _ _ _) = name
223 tyClDeclName (ClassDecl _ name _ _ _ _ _ _) = name
226 --------------------------------
227 tyClDeclNames :: Eq name => TyClDecl name pat -> [(name, SrcLoc)]
228 -- Returns all the binding names of the decl, along with their SrcLocs
229 -- The first one is guaranteed to be the name of the decl
230 -- For record fields, the first one counts as the SrcLoc
231 -- We use the equality to filter out duplicate field names
233 tyClDeclNames (TySynonym name _ _ loc)
236 tyClDeclNames (ClassDecl _ cls_name _ _ sigs _ _ loc)
237 = (cls_name,loc) : [(n,loc) | ClassOpSig n _ _ loc <- sigs]
239 tyClDeclNames (TyData _ _ tc_name _ cons _ _ loc _ _)
240 = (tc_name,loc) : conDeclsNames cons
242 tyClDeclNames (IfaceSig name _ _ loc) = [(name,loc)]
244 --------------------------------
245 tyClDeclSysNames :: TyClDecl name pat -> [(name, SrcLoc)]
246 -- Similar to tyClDeclNames, but returns the "implicit"
247 -- or "system" names of the declaration
249 tyClDeclSysNames (ClassDecl _ _ _ _ _ _ names loc) = [(n,loc) | n <- names]
250 tyClDeclSysNames (TyData _ _ _ _ cons _ _ _ _ _) = [(wkr_name,loc) | ConDecl _ wkr_name _ _ _ loc <- cons]
251 tyClDeclSysNames decl = []
254 --------------------------------
255 type ClassDeclSysNames name = [name]
256 -- [tycon, datacon wrapper, datacon worker,
257 -- superclass selector 1, ..., superclass selector n]
258 -- They are kept in a list rather than a tuple to make the
261 mkClassDeclSysNames :: (name, name, name, [name]) -> [name]
262 getClassDeclSysNames :: [name] -> (name, name, name, [name])
263 mkClassDeclSysNames (a,b,c,ds) = a:b:c:ds
264 getClassDeclSysNames (a:b:c:ds) = (a,b,c,ds)
268 instance (NamedThing name, Ord name) => Eq (TyClDecl name pat) where
269 -- Used only when building interface files
270 (==) (IfaceSig n1 t1 i1 _)
271 (IfaceSig n2 t2 i2 _) = n1==n2 && t1==t2 && i1==i2
273 (==) (TyData nd1 cxt1 n1 tvs1 cons1 _ _ _ _ _)
274 (TyData nd2 cxt2 n2 tvs2 cons2 _ _ _ _ _)
277 eqWithHsTyVars tvs1 tvs2 (\ env ->
278 eq_hsContext env cxt1 cxt2 &&
279 eqListBy (eq_ConDecl env) cons1 cons2
282 (==) (TySynonym n1 tvs1 ty1 _)
283 (TySynonym n2 tvs2 ty2 _)
285 eqWithHsTyVars tvs1 tvs2 (\ env -> eq_hsType env ty1 ty2)
287 (==) (ClassDecl cxt1 n1 tvs1 fds1 sigs1 _ _ _ )
288 (ClassDecl cxt2 n2 tvs2 fds2 sigs2 _ _ _ )
290 eqWithHsTyVars tvs1 tvs2 (\ env ->
291 eq_hsContext env cxt1 cxt2 &&
292 eqListBy (eq_hsFD env) fds1 fds2 &&
293 eqListBy (eq_cls_sig env) sigs1 sigs2
296 (==) _ _ = False -- default case
298 eq_hsFD env (ns1,ms1) (ns2,ms2)
299 = eqListBy (eq_hsVar env) ns1 ns2 && eqListBy (eq_hsVar env) ms1 ms2
301 eq_cls_sig env (ClassOpSig n1 dm1 ty1 _) (ClassOpSig n2 dm2 ty2 _)
302 = n1==n2 && dm1 `eq_dm` dm2 && eq_hsType env ty1 ty2
304 -- Ignore the name of the default method for (DefMeth id)
305 -- This is used for comparing declarations before putting
306 -- them into interface files, and the name of the default
307 -- method isn't relevant
308 Nothing `eq_dm` Nothing = True
309 (Just NoDefMeth) `eq_dm` (Just NoDefMeth) = True
310 (Just GenDefMeth) `eq_dm` (Just GenDefMeth) = True
311 (Just (DefMeth _)) `eq_dm` (Just (DefMeth _)) = True
312 dm1 `eq_dm` dm2 = False
318 countTyClDecls :: [TyClDecl name pat] -> (Int, Int, Int, Int, Int)
319 -- class, data, newtype, synonym decls
321 = (length [() | ClassDecl _ _ _ _ _ _ _ _ <- decls],
322 length [() | TyData DataType _ _ _ _ _ _ _ _ _ <- decls],
323 length [() | TyData NewType _ _ _ _ _ _ _ _ _ <- decls],
324 length [() | TySynonym _ _ _ _ <- decls],
325 length [() | IfaceSig _ _ _ _ <- decls])
329 instance (NamedThing name, Outputable name, Outputable pat)
330 => Outputable (TyClDecl name pat) where
332 ppr (IfaceSig var ty info _) = hsep [ppr var, dcolon, ppr ty, pprHsIdInfo info]
334 ppr (TySynonym tycon tyvars mono_ty src_loc)
335 = hang (ptext SLIT("type") <+> pp_decl_head [] tycon tyvars <+> equals)
338 ppr (TyData new_or_data context tycon tyvars condecls ncons
339 derivings src_loc gen_conv1 gen_conv2) -- The generic names are not printed out ATM
341 (ptext keyword <+> pp_decl_head context tycon tyvars <+> equals)
342 (pp_condecls condecls ncons)
345 keyword = case new_or_data of
346 NewType -> SLIT("newtype")
347 DataType -> SLIT("data")
349 ppr (ClassDecl context clas tyvars fds sigs methods _ src_loc)
350 | null sigs -- No "where" part
353 | otherwise -- Laid out
354 = sep [hsep [top_matter, ptext SLIT("where {")],
355 nest 4 (sep [sep (map ppr_sig sigs), pp_methods, char '}'])]
357 top_matter = ptext SLIT("class") <+> pp_decl_head context clas tyvars <+> pprFundeps fds
358 ppr_sig sig = ppr sig <> semi
359 pp_methods = getPprStyle $ \ sty ->
360 if ifaceStyle sty then empty else ppr methods
362 pp_decl_head :: Outputable name => HsContext name -> name -> [HsTyVarBndr name] -> SDoc
363 pp_decl_head context thing tyvars = hsep [pprHsContext context, ppr thing, interppSP tyvars]
365 pp_condecls [] ncons = ptext SLIT("{- abstract with") <+> int ncons <+> ptext SLIT("constructors -}")
366 pp_condecls (c:cs) ncons = sep (ppr c : map (\ c -> ptext SLIT("|") <+> ppr c) cs)
368 pp_tydecl pp_head pp_decl_rhs derivings
369 = hang pp_head 4 (sep [
373 Just ds -> hsep [ptext SLIT("deriving"), parens (interpp'SP ds)]
378 %************************************************************************
380 \subsection[ConDecl]{A data-constructor declaration}
382 %************************************************************************
386 = ConDecl name -- Constructor name; this is used for the
387 -- DataCon itself, and for the user-callable wrapper Id
389 name -- Name of the constructor's 'worker Id'
390 -- Filled in as the ConDecl is built
392 [HsTyVarBndr name] -- Existentially quantified type variables
393 (HsContext name) -- ...and context
394 -- If both are empty then there are no existentials
400 = VanillaCon -- prefix-style con decl
403 | InfixCon -- infix-style con decl
407 | RecCon -- record-style con decl
408 [([name], BangType name)] -- list of "fields"
412 conDeclsNames :: Eq name => [ConDecl name] -> [(name,SrcLoc)]
413 -- See tyClDeclNames for what this does
414 -- The function is boringly complicated because of the records
415 -- And since we only have equality, we have to be a little careful
417 = snd (foldl do_one ([], []) cons)
419 do_one (flds_seen, acc) (ConDecl name _ _ _ details loc)
420 = do_details ((name,loc):acc) details
422 do_details acc (RecCon flds) = foldl do_fld (flds_seen, acc) flds
423 do_details acc other = (flds_seen, acc)
425 do_fld acc (flds, _) = foldl do_fld1 acc flds
427 do_fld1 (flds_seen, acc) fld
428 | fld `elem` flds_seen = (flds_seen,acc)
429 | otherwise = (fld:flds_seen, (fld,loc):acc)
433 conDetailsTys :: ConDetails name -> [HsType name]
434 conDetailsTys (VanillaCon btys) = map getBangType btys
435 conDetailsTys (InfixCon bty1 bty2) = [getBangType bty1, getBangType bty2]
436 conDetailsTys (RecCon fields) = [getBangType bty | (_, bty) <- fields]
439 eq_ConDecl env (ConDecl n1 _ tvs1 cxt1 cds1 _)
440 (ConDecl n2 _ tvs2 cxt2 cds2 _)
442 (eq_hsTyVars env tvs1 tvs2 $ \ env ->
443 eq_hsContext env cxt1 cxt2 &&
444 eq_ConDetails env cds1 cds2)
446 eq_ConDetails env (VanillaCon bts1) (VanillaCon bts2)
447 = eqListBy (eq_btype env) bts1 bts2
448 eq_ConDetails env (InfixCon bta1 btb1) (InfixCon bta2 btb2)
449 = eq_btype env bta1 bta2 && eq_btype env btb1 btb2
450 eq_ConDetails env (RecCon fs1) (RecCon fs2)
451 = eqListBy (eq_fld env) fs1 fs2
452 eq_ConDetails env _ _ = False
454 eq_fld env (ns1,bt1) (ns2, bt2) = ns1==ns2 && eq_btype env bt1 bt2
459 = Banged (HsType name) -- HsType: to allow Haskell extensions
460 | Unbanged (HsType name) -- (MonoType only needed for straight Haskell)
461 | Unpacked (HsType name) -- Field is strict and to be unpacked if poss.
463 getBangType (Banged ty) = ty
464 getBangType (Unbanged ty) = ty
465 getBangType (Unpacked ty) = ty
467 eq_btype env (Banged t1) (Banged t2) = eq_hsType env t1 t2
468 eq_btype env (Unbanged t1) (Unbanged t2) = eq_hsType env t1 t2
469 eq_btype env (Unpacked t1) (Unpacked t2) = eq_hsType env t1 t2
470 eq_btype env _ _ = False
474 instance (Outputable name) => Outputable (ConDecl name) where
475 ppr (ConDecl con _ tvs cxt con_details loc)
476 = sep [pprHsForAll tvs cxt, ppr_con_details con con_details]
478 ppr_con_details con (InfixCon ty1 ty2)
479 = hsep [ppr_bang ty1, ppr con, ppr_bang ty2]
481 ppr_con_details con (VanillaCon tys)
482 = ppr con <+> hsep (map (ppr_bang) tys)
484 ppr_con_details con (RecCon fields)
485 = ppr con <+> braces (hsep (punctuate comma (map ppr_field fields)))
487 ppr_field (ns, ty) = hsep (map (ppr) ns) <+>
491 instance Outputable name => Outputable (BangType name) where
494 ppr_bang (Banged ty) = ptext SLIT("!") <> pprParendHsType ty
495 ppr_bang (Unbanged ty) = pprParendHsType ty
496 ppr_bang (Unpacked ty) = ptext SLIT("! !") <> pprParendHsType ty
500 %************************************************************************
502 \subsection[InstDecl]{An instance declaration
504 %************************************************************************
507 data InstDecl name pat
508 = InstDecl (HsType name) -- Context => Class Instance-type
509 -- Using a polytype means that the renamer conveniently
510 -- figures out the quantified type variables for us.
514 [Sig name] -- User-supplied pragmatic info
516 (Maybe name) -- Name for the dictionary function
517 -- Nothing for source-file instance decls
523 instance (Outputable name, Outputable pat)
524 => Outputable (InstDecl name pat) where
526 ppr (InstDecl inst_ty binds uprags maybe_dfun_name src_loc)
527 = getPprStyle $ \ sty ->
528 if ifaceStyle sty then
529 hsep [ptext SLIT("instance"), ppr inst_ty, equals, pp_dfun]
531 vcat [hsep [ptext SLIT("instance"), ppr inst_ty, ptext SLIT("where")],
535 pp_dfun = case maybe_dfun_name of
541 instance Ord name => Eq (InstDecl name pat) where
542 -- Used for interface comparison only, so don't compare bindings
543 (==) (InstDecl inst_ty1 _ _ dfun1 _) (InstDecl inst_ty2 _ _ dfun2 _)
544 = inst_ty1 == inst_ty2 && dfun1 == dfun2
548 %************************************************************************
550 \subsection[DefaultDecl]{A @default@ declaration}
552 %************************************************************************
554 There can only be one default declaration per module, but it is hard
555 for the parser to check that; we pass them all through in the abstract
556 syntax, and that restriction must be checked in the front end.
559 data DefaultDecl name
560 = DefaultDecl [HsType name]
563 instance (Outputable name)
564 => Outputable (DefaultDecl name) where
566 ppr (DefaultDecl tys src_loc)
567 = ptext SLIT("default") <+> parens (interpp'SP tys)
570 %************************************************************************
572 \subsection{Foreign function interface declaration}
574 %************************************************************************
577 data ForeignDecl name =
586 instance (Outputable name)
587 => Outputable (ForeignDecl name) where
589 ppr (ForeignDecl nm imp_exp ty ext_name cconv src_loc)
590 = ptext SLIT("foreign") <+> ppr_imp_exp <+> pprCallConv cconv <+>
591 ppr ext_name <+> ppr_unsafe <+> ppr nm <+> dcolon <+> ppr ty
593 (ppr_imp_exp, ppr_unsafe) =
595 FoLabel -> (ptext SLIT("label"), empty)
596 FoExport -> (ptext SLIT("export"), empty)
598 | us -> (ptext SLIT("import"), ptext SLIT("unsafe"))
599 | otherwise -> (ptext SLIT("import"), empty)
604 | FoImport Bool -- True => unsafe call.
608 | ExtName CLabelString -- The external name of the foreign thing,
609 (Maybe CLabelString) -- and optionally its DLL or module name
610 -- Both of these are completely unencoded;
611 -- we just print them as they are
613 isDynamicExtName :: ExtName -> Bool
614 isDynamicExtName Dynamic = True
615 isDynamicExtName _ = False
617 extNameStatic :: ExtName -> CLabelString
618 extNameStatic (ExtName f _) = f
619 extNameStatic Dynamic = panic "staticExtName: Dynamic - shouldn't ever happen."
621 instance Outputable ExtName where
622 ppr Dynamic = ptext SLIT("dynamic")
623 ppr (ExtName nm mb_mod) =
624 case mb_mod of { Nothing -> empty; Just m -> doubleQuotes (ptext m) } <+>
625 doubleQuotes (pprCLabelString nm)
628 %************************************************************************
630 \subsection{Transformation rules}
632 %************************************************************************
635 data RuleDecl name pat
636 = HsRule -- Source rule
637 FAST_STRING -- Rule name
638 [name] -- Forall'd tyvars, filled in by the renamer with
639 -- tyvars mentioned in sigs; then filled out by typechecker
640 [RuleBndr name] -- Forall'd term vars
641 (HsExpr name pat) -- LHS
642 (HsExpr name pat) -- RHS
645 | IfaceRule -- One that's come in from an interface file; pre-typecheck
647 [UfBinder name] -- Tyvars and term vars
649 [UfExpr name] -- Args of LHS
650 (UfExpr name) -- Pre typecheck
653 | IfaceRuleOut -- Post typecheck
657 isIfaceRuleDecl (HsRule _ _ _ _ _ _) = False
658 isIfaceRuleDecl other = True
660 ifaceRuleDeclName :: RuleDecl name pat -> name
661 ifaceRuleDeclName (IfaceRule _ _ n _ _ _) = n
662 ifaceRuleDeclName (IfaceRuleOut n r) = n
663 ifaceRuleDeclName (HsRule fs _ _ _ _ _) = pprPanic "ifaceRuleDeclName" (ppr fs)
667 | RuleBndrSig name (HsType name)
669 instance (NamedThing name, Ord name) => Eq (RuleDecl name pat) where
670 -- Works for IfaceRules only; used when comparing interface file versions
671 (IfaceRule n1 bs1 f1 es1 rhs1 _) == (IfaceRule n2 bs2 f2 es2 rhs2 _)
672 = n1==n2 && f1 == f2 &&
673 eq_ufBinders emptyEqHsEnv bs1 bs2 (\env ->
674 eqListBy (eq_ufExpr env) (rhs1:es1) (rhs2:es2))
676 instance (NamedThing name, Outputable name, Outputable pat)
677 => Outputable (RuleDecl name pat) where
678 ppr (HsRule name tvs ns lhs rhs loc)
679 = sep [text "{-# RULES" <+> doubleQuotes (ptext name),
680 pp_forall, ppr lhs, equals <+> ppr rhs,
683 pp_forall | null tvs && null ns = empty
684 | otherwise = text "forall" <+>
685 fsep (map ppr tvs ++ map ppr ns)
688 ppr (IfaceRule name tpl_vars fn tpl_args rhs loc)
689 = hsep [ doubleQuotes (ptext name),
690 ptext SLIT("__forall") <+> braces (interppSP tpl_vars),
691 ppr fn <+> sep (map (pprUfExpr parens) tpl_args),
692 ptext SLIT("=") <+> ppr rhs
695 ppr (IfaceRuleOut fn rule) = pprCoreRule (ppr fn) rule
697 instance Outputable name => Outputable (RuleBndr name) where
698 ppr (RuleBndr name) = ppr name
699 ppr (RuleBndrSig name ty) = ppr name <> dcolon <> ppr ty
703 %************************************************************************
705 \subsection[DeprecDecl]{Deprecations}
707 %************************************************************************
709 We use exported entities for things to deprecate.
712 data DeprecDecl name = Deprecation name DeprecTxt SrcLoc
714 type DeprecTxt = FAST_STRING -- reason/explanation for deprecation
716 instance Outputable name => Outputable (DeprecDecl name) where
717 ppr (Deprecation thing txt _)
718 = hsep [text "{-# DEPRECATED", ppr thing, doubleQuotes (ppr txt), text "#-}"]