Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
27206c5e
by sheaf at 2025-08-29T17:28:14-04:00
7 changed files:
- compiler/GHC/ThToHs.hs
- libraries/ghc-boot-th/GHC/Boot/TH/Ppr.hs
- libraries/ghc-internal/src/GHC/Internal/TH/Syntax.hs
- libraries/template-haskell/Language/Haskell/TH/Lib.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- libraries/template-haskell/changelog.md
- testsuite/tests/interface-stability/template-haskell-exports.stdout
Changes:
... | ... | @@ -915,12 +915,6 @@ cvtPragmaD (OpaqueP nm) |
915 | 915 | srcTxt = SourceText $ fsLit "{-# OPAQUE"
|
916 | 916 | ; returnJustLA $ Hs.SigD noExtField $ InlineSig noAnn nm' ip }
|
917 | 917 | |
918 | -cvtPragmaD (SpecialiseP nm ty inline phases)
|
|
919 | - = do { nm' <- vNameN nm
|
|
920 | - ; ty' <- cvtSigType ty
|
|
921 | - ; let ip = cvtInlinePhases inline phases
|
|
922 | - ; returnJustLA $ Hs.SigD noExtField $ SpecSig noAnn nm' [ty'] ip }
|
|
923 | - |
|
924 | 918 | cvtPragmaD (SpecialiseInstP ty)
|
925 | 919 | = do { ty' <- cvtSigType ty
|
926 | 920 | ; returnJustLA $ Hs.SigD noExtField $
|
... | ... | @@ -646,13 +646,6 @@ instance Ppr Pragma where |
646 | 646 | <+> text "#-}"
|
647 | 647 | ppr (OpaqueP n)
|
648 | 648 | = text "{-# OPAQUE" <+> pprName' Applied n <+> text "#-}"
|
649 | - ppr (SpecialiseP n ty inline phases)
|
|
650 | - = text "{-# SPECIALISE"
|
|
651 | - <+> maybe empty ppr inline
|
|
652 | - <+> ppr phases
|
|
653 | - <+> sep [ pprName' Applied n <+> dcolon
|
|
654 | - , nest 2 $ ppr ty ]
|
|
655 | - <+> text "#-}"
|
|
656 | 649 | ppr (SpecialiseEP ty_bndrs tm_bndrs spec_e inline phases)
|
657 | 650 | = sep [ text "{-# SPECIALISE"
|
658 | 651 | <+> maybe empty ppr inline
|
... | ... | @@ -2115,12 +2115,8 @@ data Pragma = InlineP Name Inline RuleMatch Phases |
2115 | 2115 | -- 'Inline' and 'RuleMatch'.
|
2116 | 2116 | | OpaqueP Name
|
2117 | 2117 | -- ^ @{ {\-\# OPAQUE T #-} }@
|
2118 | - | SpecialiseP Name Type (Maybe Inline) Phases
|
|
2119 | - -- ^ @{ {\-\# SPECIALISE [INLINE] [phases] nm :: ty #-} }@
|
|
2120 | - --
|
|
2121 | - -- NB: this constructor is deprecated and will be removed in GHC 9.18
|
|
2122 | 2118 | | SpecialiseEP (Maybe [TyVarBndr ()]) [RuleBndr] Exp (Maybe Inline) Phases
|
2123 | - -- ^ @{ {\-\# SPECIALISE [INLINE] [phases] exp #-} }@
|
|
2119 | + -- ^ @{ {\-\# SPECIALISE [forall t_1 ... t_i]. [forall b_1 ... b_j] [INLINE] [phases] exp #-} }@
|
|
2124 | 2120 | | SpecialiseInstP Type
|
2125 | 2121 | -- ^ @{ {\-\# SPECIALISE instance I #-} }@
|
2126 | 2122 | | RuleP String (Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases
|
... | ... | @@ -443,16 +443,14 @@ varStrictType :: Quote m => Name -> m StrictType -> m VarStrictType |
443 | 443 | varStrictType = varBangType
|
444 | 444 | |
445 | 445 | --------------------------------------------------------------------------------
|
446 | --- * Specialisation pragmas (deprecated)
|
|
446 | +-- * Specialisation pragmas (backwards compatibility)
|
|
447 | 447 | |
448 | -{-# DEPRECATED pragSpecD "Please use 'pragSpecED' instead. 'pragSpecD' will be removed in GHC 9.18." #-}
|
|
449 | 448 | pragSpecD :: Quote m => Name -> m Type -> Phases -> m Dec
|
450 | 449 | pragSpecD n ty phases
|
451 | 450 | = do
|
452 | 451 | ty1 <- ty
|
453 | 452 | pure $ PragmaD $ SpecialiseP n ty1 Nothing phases
|
454 | 453 | |
455 | -{-# DEPRECATED pragSpecInlD "Please use 'pragSpecInlED' instead. 'pragSpecInlD' will be removed in GHC 9.18." #-}
|
|
456 | 454 | pragSpecInlD :: Quote m => Name -> m Type -> Inline -> Phases -> m Dec
|
457 | 455 | pragSpecInlD n ty inline phases
|
458 | 456 | = do
|
1 | 1 | {-# LANGUAGE MagicHash #-}
|
2 | +{-# LANGUAGE PatternSynonyms #-}
|
|
2 | 3 | {-# LANGUAGE RankNTypes #-}
|
3 | 4 | {-# LANGUAGE ScopedTypeVariables #-}
|
4 | 5 | {-# LANGUAGE TemplateHaskellQuotes #-}
|
... | ... | @@ -157,7 +158,7 @@ module Language.Haskell.TH.Syntax ( |
157 | 158 | PatSynType,
|
158 | 159 | Phases (..),
|
159 | 160 | PkgName (..),
|
160 | - Pragma (..),
|
|
161 | + Pragma (SpecialiseP, ..),
|
|
161 | 162 | Quasi (..),
|
162 | 163 | Range (..),
|
163 | 164 | Role (..),
|
... | ... | @@ -457,3 +458,12 @@ reassociate the tree as necessary. |
457 | 458 | 'InfixT', 'PromotedInfixT, 'ParensE', 'ParensP', or 'ParensT' constructors.
|
458 | 459 | |
459 | 460 | -}
|
461 | + |
|
462 | +--------------------------------------------------------------------------------
|
|
463 | +-- Back-compat for Specialise pragmas
|
|
464 | + |
|
465 | +-- | Old-form specialise pragma @{ {\-\# SPECIALISE [INLINE] [phases] (var :: ty) #-} }@.
|
|
466 | +--
|
|
467 | +-- Subsumed by the more general 'SpecialiseEP' constructor.
|
|
468 | +pattern SpecialiseP :: Name -> Type -> (Maybe Inline) -> Phases -> Pragma
|
|
469 | +pattern SpecialiseP nm ty inl phases = SpecialiseEP Nothing [] (SigE (VarE nm) ty) inl phases |
... | ... | @@ -7,16 +7,9 @@ |
7 | 7 | |
8 | 8 | * Introduce `dataToCodeQ` and `liftDataTyped`, typed variants of `dataToExpQ` and `liftData` respectively.
|
9 | 9 | |
10 | - * As part of the implementation of [GHC proposal 493](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0493-specialise-expressions.rst),
|
|
11 | - the ``SpecialiseP`` constructor of `Pragma`, as well as the helper functions
|
|
12 | - `pragSpecD` and `pragSpecInlD`, have been deprecated.
|
|
13 | - |
|
14 | - They are replaced, respectively, by `SpecialiseEP`, `pragSpecED` and
|
|
15 | - `pragSpecInlED`.
|
|
16 | -
|
|
17 | 10 | * Remove the `Language.Haskell.TH.Lib.Internal` module. This module has long been deprecated, and exposes compiler internals.
|
18 | 11 | Users should use `Language.Haskell.TH.Lib` instead, which exposes a more stable version of this API.
|
19 | -
|
|
12 | + |
|
20 | 13 | * Remove `addrToByteArrayName` and `addrToByteArray` from `Language.Haskell.TH.Syntax`. These were part of the implementation of the `Lift ByteArray` instance and were accidentally exported because this module lacked an explicit export list. They have no usages on Hackage.
|
21 | 14 | |
22 | 15 | ## 2.23.0.0
|
... | ... | @@ -347,7 +347,7 @@ module Language.Haskell.TH where |
347 | 347 | ppr_list :: [a] -> GHC.Boot.TH.PprLib.Doc
|
348 | 348 | {-# MINIMAL ppr #-}
|
349 | 349 | type Pragma :: *
|
350 | - data Pragma = InlineP Name Inline RuleMatch Phases | OpaqueP Name | SpecialiseP Name Type (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseEP (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseInstP Type | RuleP GHC.Internal.Base.String (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases | AnnP AnnTarget Exp | LineP GHC.Internal.Types.Int GHC.Internal.Base.String | CompleteP [Name] (GHC.Internal.Maybe.Maybe Name) | SCCP Name (GHC.Internal.Maybe.Maybe GHC.Internal.Base.String)
|
|
350 | + data Pragma = InlineP Name Inline RuleMatch Phases | OpaqueP Name | SpecialiseEP (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseInstP Type | RuleP GHC.Internal.Base.String (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases | AnnP AnnTarget Exp | LineP GHC.Internal.Types.Int GHC.Internal.Base.String | CompleteP [Name] (GHC.Internal.Maybe.Maybe Name) | SCCP Name (GHC.Internal.Maybe.Maybe GHC.Internal.Base.String)
|
|
351 | 351 | type Pred :: *
|
352 | 352 | type Pred = Type
|
353 | 353 | type PredQ :: *
|
... | ... | @@ -381,6 +381,7 @@ module Language.Haskell.TH where |
381 | 381 | data SourceUnpackedness = NoSourceUnpackedness | SourceNoUnpack | SourceUnpack
|
382 | 382 | type SourceUnpackednessQ :: *
|
383 | 383 | type SourceUnpackednessQ = Q SourceUnpackedness
|
384 | + pattern SpecialiseP :: Name -> Type -> GHC.Internal.Maybe.Maybe Inline -> Phases -> Pragma
|
|
384 | 385 | type Specificity :: *
|
385 | 386 | data Specificity = SpecifiedSpec | InferredSpec
|
386 | 387 | type Stmt :: *
|
... | ... | @@ -1693,7 +1694,7 @@ module Language.Haskell.TH.Syntax where |
1693 | 1694 | type PkgName :: *
|
1694 | 1695 | newtype PkgName = PkgName GHC.Internal.Base.String
|
1695 | 1696 | type Pragma :: *
|
1696 | - data Pragma = InlineP Name Inline RuleMatch Phases | OpaqueP Name | SpecialiseP Name Type (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseEP (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseInstP Type | RuleP GHC.Internal.Base.String (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases | AnnP AnnTarget Exp | LineP GHC.Internal.Types.Int GHC.Internal.Base.String | CompleteP [Name] (GHC.Internal.Maybe.Maybe Name) | SCCP Name (GHC.Internal.Maybe.Maybe GHC.Internal.Base.String)
|
|
1697 | + data Pragma = InlineP Name Inline RuleMatch Phases | OpaqueP Name | SpecialiseEP (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp (GHC.Internal.Maybe.Maybe Inline) Phases | SpecialiseInstP Type | RuleP GHC.Internal.Base.String (GHC.Internal.Maybe.Maybe [TyVarBndr ()]) [RuleBndr] Exp Exp Phases | AnnP AnnTarget Exp | LineP GHC.Internal.Types.Int GHC.Internal.Base.String | CompleteP [Name] (GHC.Internal.Maybe.Maybe Name) | SCCP Name (GHC.Internal.Maybe.Maybe GHC.Internal.Base.String)
|
|
1697 | 1698 | type Pred :: *
|
1698 | 1699 | type Pred = Type
|
1699 | 1700 | type role Q nominal
|
... | ... | @@ -1748,6 +1749,7 @@ module Language.Haskell.TH.Syntax where |
1748 | 1749 | data SourceStrictness = NoSourceStrictness | SourceLazy | SourceStrict
|
1749 | 1750 | type SourceUnpackedness :: *
|
1750 | 1751 | data SourceUnpackedness = NoSourceUnpackedness | SourceNoUnpack | SourceUnpack
|
1752 | + pattern SpecialiseP :: Name -> Type -> GHC.Internal.Maybe.Maybe Inline -> Phases -> Pragma
|
|
1751 | 1753 | type Specificity :: *
|
1752 | 1754 | data Specificity = SpecifiedSpec | InferredSpec
|
1753 | 1755 | type Stmt :: *
|