summaryrefslogtreecommitdiff
path: root/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2013-09-11 00:56:03 -0400
committerRichard Eisenberg <eir@cis.upenn.edu>2013-09-17 21:20:29 -0400
commit98a63b910683710c80349bebbd8d1897d7410af6 (patch)
treec9cc2c66fb30ad769486dea0396409aeab7b6606 /libraries/template-haskell/Language/Haskell/TH/Ppr.hs
parenta1233f237a1f2a92682058ce0ca80bbab4633c40 (diff)
downloadhaskell-98a63b910683710c80349bebbd8d1897d7410af6.tar.gz
Support new role annotation syntax.
This reverts the change to TyVarBndr (which now has only two constructors, PlainTV and KindedTV) and adds a new Dec, RoleAnnotD. There is also an updated definition for the type Role, to allow for wildcard annotations.
Diffstat (limited to 'libraries/template-haskell/Language/Haskell/TH/Ppr.hs')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Ppr.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
index 415f171c10..8222085375 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -307,6 +307,8 @@ ppr_dec _ (ClosedTypeFamilyD tc tvs mkind eqns)
ppr_eqn (TySynEqn lhs rhs)
= ppr tc <+> sep (map pprParendType lhs) <+> text "=" <+> ppr rhs
+ppr_dec _ (RoleAnnotD name roles)
+ = hsep [ text "type role", ppr name ] <+> hsep (map ppr roles)
ppr_data :: Doc -> Cxt -> Name -> Doc -> [Con] -> [Name] -> Doc
ppr_data maybeInst ctxt t argsDoc cs decs
@@ -502,14 +504,12 @@ instance Ppr TyLit where
instance Ppr TyVarBndr where
ppr (PlainTV nm) = ppr nm
ppr (KindedTV nm k) = parens (ppr nm <+> text "::" <+> ppr k)
- ppr (RoledTV nm r) = ppr nm <> text "@" <> ppr r
- ppr (KindedRoledTV nm k r)
- = parens (ppr nm <+> text "::" <+> ppr k) <> text "@" <> ppr r
instance Ppr Role where
- ppr Nominal = text "N"
- ppr Representational = text "R"
- ppr Phantom = text "P"
+ ppr NominalR = text "nominal"
+ ppr RepresentationalR = text "representational"
+ ppr PhantomR = text "phantom"
+ ppr InferR = text "_"
------------------------------
pprCxt :: Cxt -> Doc