summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'libraries')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs3
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Ppr.hs2
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs1
3 files changed, 6 insertions, 0 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
index 95ccf39447..e960f35bb3 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Lib/Internal.hs
@@ -484,6 +484,9 @@ pragInlD :: Quote m => Name -> Inline -> RuleMatch -> Phases -> m Dec
pragInlD name inline rm phases
= pure $ PragmaD $ InlineP name inline rm phases
+pragOpaqueD :: Quote m => Name -> m Dec
+pragOpaqueD name = pure $ PragmaD $ OpaqueP name
+
pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
pragSpecD n ty phases
= do
diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
index 449a6e5087..51e89fda2a 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs
@@ -593,6 +593,8 @@ instance Ppr Pragma where
<+> ppr phases
<+> pprName' Applied n
<+> text "#-}"
+ ppr (OpaqueP n)
+ = text "{-# OPAQUE" <+> pprName' Applied n <+> text "#-}"
ppr (SpecialiseP n ty inline phases)
= text "{-# SPECIALISE"
<+> maybe empty ppr inline
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 3d3f46d2c4..5acf96e011 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -2499,6 +2499,7 @@ data Safety = Unsafe | Safe | Interruptible
deriving( Show, Eq, Ord, Data, Generic )
data Pragma = InlineP Name Inline RuleMatch Phases
+ | OpaqueP Name
| SpecialiseP Name Type (Maybe Inline) Phases
| SpecialiseInstP Type
| RuleP String (Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases