packages feed

ghc-source-gen 0.4.3.0 → 0.4.4.0

raw patch · 15 files changed

+280/−42 lines, 15 filesdep ~ghcPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: ghc

API changes (from Hackage documentation)

+ GHC.SourceGen.Overloaded: instance GHC.SourceGen.Overloaded.BVar GHC.SourceGen.Syntax.Internal.HsTyVarBndrS'
- GHC.SourceGen.Module: type HsModule' = HsModule GhcPs
+ GHC.SourceGen.Module: type HsModule' = HsModule
- GHC.SourceGen.Type: type HsTyVarBndr' = HsTyVarBndr GhcPs
+ GHC.SourceGen.Type: type HsTyVarBndr' = HsTyVarBndr () GhcPs

Files

ChangeLog.md view
@@ -1,5 +1,8 @@ # Changelog for haskell-syntax +# 0.4.4.0+- Support GHC 9.6.+ # 0.4.3.0 - Support GHC 9.2. 
README.md view
@@ -21,12 +21,13 @@ {-# LANGUAGE NoMonomorphismRestriction #-} import GHC.SourceGen import GHC.Paths (libdir)+import GHC (runGhc)  constModule :: HsModule' constModule =     module' (Just "Const") (Just [var "const"]) []         [ typeSig "const" $ a --> b --> a-        , funBind "const" $ match [wildP, x] x+        , funBind "const" $ match [x, wildP] x         ]   where     a = var "a"@@ -43,7 +44,7 @@         const     ) where const :: a -> b -> a-const _ x = x+const x _ = x ```  ## Comparison with the GHC API
ghc-source-gen.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.34.6. -- -- see: https://github.com/sol/hpack  name:           ghc-source-gen-version:        0.4.3.0+version:        0.4.4.0 synopsis:       Constructs Haskell syntax trees for the GHC API. description:    @ghc-source-gen@ is a library for generating Haskell source code.                 It uses the <https://hackage.haskell.org/package/ghc ghc> library@@ -61,7 +61,7 @@       TypeSynonymInstances   build-depends:       base >=4.7 && <5-    , ghc >=8.4 && <9.3+    , ghc >=8.4 && <9.7   if impl(ghc<8.10)     other-modules:         GHC.Hs@@ -72,17 +72,11 @@         GHC.Hs.ImpExp         GHC.Hs.Lit         GHC.Hs.Pat-        GHC.Hs.Type         GHC.Hs.Utils-        GHC.Driver.Monad-        GHC.Driver.Session-        GHC.Utils.Outputable-        GHC.Types.Basic-        GHC.Plugins-        GHC.Tc.Types.Evidence     hs-source-dirs:         compat-  if impl(ghc>=8.10) && impl(ghc<9.0)+  default-language: Haskell2010+  if impl(ghc<9.0)     other-modules:         GHC.Hs.Type         GHC.Driver.Monad@@ -91,9 +85,9 @@         GHC.Types.Basic         GHC.Plugins         GHC.Tc.Types.Evidence+  if impl(ghc>=8.10) && impl(ghc<9.0)     hs-source-dirs:         compat-8.10-  default-language: Haskell2010  test-suite name_test   type: exitcode-stdio-1.0@@ -110,7 +104,7 @@   build-depends:       QuickCheck >=2.10 && <2.15     , base >=4.7 && <5-    , ghc >=8.4 && <9.3+    , ghc >=8.4 && <9.7     , ghc-source-gen     , tasty >=1.0 && <1.5     , tasty-hunit ==0.10.*@@ -131,7 +125,7 @@       TypeSynonymInstances   build-depends:       base >=4.7 && <5-    , ghc >=8.4 && <9.3+    , ghc >=8.4 && <9.7     , ghc-paths ==0.1.*     , ghc-source-gen     , tasty >=1.0 && <1.5@@ -157,7 +151,7 @@       TypeSynonymInstances   build-depends:       base >=4.7 && <5-    , ghc >=8.4 && <9.3+    , ghc >=8.4 && <9.7     , ghc-paths ==0.1.*     , ghc-source-gen     , tasty >=1.0 && <1.5
src/GHC/SourceGen/Binds.hs view
@@ -101,12 +101,14 @@ funBindsWithFixity :: HasValBind t => Maybe LexicalFixity -> OccNameStr -> [RawMatch] -> t funBindsWithFixity fixity name matches = bindB $ withPlaceHolder         (noExt FunBind name'-            (matchGroup context matches) +            (matchGroup context matches) #if !MIN_VERSION_ghc(9,0,1)             WpHole #endif             )+#if !MIN_VERSION_ghc(9,6,0)         []+#endif   where     name' = valueRdrName $ unqual name     occ = valueOccName name@@ -189,7 +191,9 @@         $ withPlaceHolder             (withPlaceHolder                 (withEpAnnNotUsed PatBind (builtPat p) (mkGRHSs g)))+#if !MIN_VERSION_ghc(9,6,0)         $ ([],[])+#endif  -- | Defines a pattern binding without any guards. --
src/GHC/SourceGen/Binds/Internal.hs view
@@ -83,12 +83,19 @@  matchGroup :: HsMatchContext' -> [RawMatch] -> MatchGroup' LHsExpr' matchGroup context matches =-    noExt MG (mkLocated $ map (mkLocated . mkMatch) matches)+#if MIN_VERSION_ghc(9,6,0)+    MG Generated+#else+    noExt MG+#endif+                            matches' #if !MIN_VERSION_ghc(8,6,0)                             [] PlaceHolder-#endif+#elif !MIN_VERSION_ghc(9,6,0)                             Generated+#endif                               where+    matches' = mkLocated $ map (mkLocated . mkMatch) matches     mkMatch :: RawMatch -> Match' LHsExpr'     mkMatch r = withEpAnnNotUsed Match context                     (map builtPat $ map parenthesize $ rawMatchPats r)@@ -96,7 +103,11 @@  mkGRHSs :: RawGRHSs -> GRHSs' LHsExpr' mkGRHSs g = withEmptyEpAnnComments GRHSs+#if MIN_VERSION_ghc(9,4,0)+                (map mkLocated $ rawGRHSs g)+#else                 (map builtLoc $ rawGRHSs g)+#endif                 (fromLocalBinds $ valBinds $ rawGRHSWhere g)   where #if MIN_VERSION_ghc(9,2,0)
src/GHC/SourceGen/Decl.hs view
@@ -54,15 +54,20 @@ #if MIN_VERSION_ghc(9,0,0) import GHC (LexicalFixity(Prefix)) import GHC.Data.Bag (listToBag)-import GHC.Types.SrcLoc (LayoutInfo(..))++#if MIN_VERSION_ghc(9,6,0)+import GHC (GhcPs, LayoutInfo (NoLayoutInfo)) #else+import GHC.Types.SrcLoc (LayoutInfo(NoLayoutInfo))+#endif++#else import BasicTypes (LexicalFixity(Prefix)) import Bag (listToBag) #endif #if !MIN_VERSION_ghc(8,6,0) import BasicTypes (DerivStrategy(..)) #endif-import GHC (GhcPs) import GHC.Hs.Binds import GHC.Hs.Decls @@ -108,6 +113,7 @@ import GHC.SourceGen.Name.Internal import GHC.SourceGen.Syntax.Internal import GHC.SourceGen.Type.Internal+import GHC.Hs  -- | A definition that can appear in the body of a @class@ declaration. --@@ -174,7 +180,10 @@ class' context name vars decls     = noExt TyClD $ ClassDecl             { tcdCtxt = toHsContext $ mkLocated $ map mkLocated context-#if MIN_VERSION_ghc(9,2,0)+#if MIN_VERSION_ghc(9,6,0)+            , tcdLayout = NoLayoutInfo+            , tcdCExt = (EpAnnNotUsed, NoAnnSortKey)+#elif MIN_VERSION_ghc(9,2,0)             , tcdCExt = (EpAnnNotUsed, NoAnnSortKey, NoLayoutInfo) #elif MIN_VERSION_ghc(9,0,0)             , tcdCExt = NoLayoutInfo@@ -323,12 +332,28 @@         withEpAnnNotUsed DataDecl (typeRdrName $ unqual name)             (mkQTyVars vars)             Prefix-            $ noExt HsDataDefn newOrData+            $ noExt HsDataDefn+#if !MIN_VERSION_ghc(9,6,0)+                newOrData+#endif                 cxt                 Nothing                 Nothing+#if MIN_VERSION_ghc(9,6,0)+                (case newOrData of+                    NewType -> case conDecls of+                        [decl] -> NewTypeCon $ mkLocated decl+                        _ -> error "NewTypeCon with more than one decl"+                    DataType -> DataTypeCons False (map mkLocated conDecls)+                )  +#else                 (map mkLocated conDecls)+#endif+#if MIN_VERSION_ghc(9,4,0)+                (toHsDeriving $ map mkLocated derivs)+#else                 (toHsDeriving $ map builtLoc derivs)+#endif   where #if MIN_VERSION_ghc(9,2,0)     cxt = Nothing@@ -402,7 +427,11 @@   where     mkLConDeclField (n, f) =         mkLocated $ withEpAnnNotUsed ConDeclField+#if MIN_VERSION_ghc(9,4,0)+                        [mkLocated $ withPlaceHolder $ noExt FieldOcc $ valueRdrName $ unqual n]+#else                         [builtLoc $ withPlaceHolder $ noExt FieldOcc $ valueRdrName $ unqual n]+#endif                         (renderField f)                         Nothing @@ -471,7 +500,11 @@  derivingWay :: Maybe DerivStrategy' -> [HsType'] -> HsDerivingClause' derivingWay way ts =+#if MIN_VERSION_ghc(9,4,0)+    withEpAnnNotUsed HsDerivingClause (fmap mkLocated way) $ mkLocated $ derivClauseTys $ map sigType ts+#else     withEpAnnNotUsed HsDerivingClause (fmap builtLoc way) $ mkLocated $ derivClauseTys $ map sigType ts+#endif   where #if MIN_VERSION_ghc(9,2,0)     derivClauseTys [x] = noExt DctSingle x@@ -557,7 +590,11 @@ standaloneDerivingWay :: Maybe DerivStrategy' -> HsType' -> HsDecl' standaloneDerivingWay way ty = noExt DerivD derivDecl   where derivDecl =+#if MIN_VERSION_ghc(9,4,0)+          withEpAnnNotUsed DerivDecl (hsWC $ sigType ty) (fmap mkLocated way) Nothing+#else           withEpAnnNotUsed DerivDecl (hsWC $ sigType ty) (fmap builtLoc way) Nothing+#endif         hsWC = #if MIN_VERSION_ghc(8,6,0)           noExt HsWC
src/GHC/SourceGen/Expr.hs view
@@ -30,7 +30,15 @@  import GHC.Hs.Expr import GHC.Hs.Extension (GhcPs)+#if MIN_VERSION_ghc(9,6,0)+import GHC.Hs.Extension (noHsTok)+import GHC.Types.SourceText (SourceText(NoSourceText))+#endif+#if MIN_VERSION_ghc(9,4,0)+import GHC.Hs.Pat (HsFieldBind(..), HsRecFields(..))+#else import GHC.Hs.Pat (HsRecField'(..), HsRecFields(..))+#endif import GHC.Hs.Type (FieldOcc(..), AmbiguousFieldOcc(..)) import GHC.Hs.Utils (mkHsIf) import Data.String (fromString)@@ -63,14 +71,20 @@ overLabel :: String -> HsExpr' overLabel = hsOverLabel . fromString   where-#if MIN_VERSION_ghc(9,2,0)+#if MIN_VERSION_ghc(9,6,0)+    hsOverLabel = withEpAnnNotUsed HsOverLabel NoSourceText+#elif MIN_VERSION_ghc(9,2,0)     hsOverLabel = withEpAnnNotUsed HsOverLabel #else     hsOverLabel = noExt HsOverLabel Nothing #endif  let' :: [RawValBind] -> HsExpr' -> HsExpr'+#if MIN_VERSION_ghc(9,4,0)+let' binds e = withEpAnnNotUsed HsLet mkToken (toHsLocalBinds $ valBinds binds) mkToken $ mkLocated e+#else let' binds e = withEpAnnNotUsed HsLet (toHsLocalBinds $ valBinds binds) $ mkLocated e+#endif   where #if MIN_VERSION_ghc(9,2,0)     toHsLocalBinds = id@@ -86,7 +100,11 @@ lambda ps e = noExt HsLam $ matchGroup LambdaExpr [match ps e]  lambdaCase :: [RawMatch] -> HsExpr'+#if MIN_VERSION_ghc(9,4,0)+lambdaCase = withEpAnnNotUsed HsLamCase LamCase . matchGroup CaseAlt+#else lambdaCase = withEpAnnNotUsed HsLamCase . matchGroup CaseAlt+#endif  if' :: HsExpr' -> HsExpr' -> HsExpr' -> HsExpr' if' x y z = mkHsIf@@ -109,7 +127,11 @@ -- >     , guardedStmt (var "otherwise") $ rhs (string "h") -- >     ] multiIf :: [GuardedExpr] -> HsExpr'+#if MIN_VERSION_ghc(9,4,0)+multiIf = withPlaceHolder (withEpAnnNotUsed HsMultiIf) . map mkLocated+#else multiIf = withPlaceHolder (withEpAnnNotUsed HsMultiIf) . map builtLoc+#endif  -- | A do-expression. --@@ -182,7 +204,9 @@ -- > ===== -- > var "f" @@ var "Int" tyApp :: HsExpr' -> HsType' -> HsExpr'-#if MIN_VERSION_ghc(9,2,0)+#if MIN_VERSION_ghc(9,6,0)+tyApp e t = noExt HsAppType e' noHsTok t'+#elif MIN_VERSION_ghc(9,2,0) tyApp e t = HsAppType builtSpan e' t' #elif MIN_VERSION_ghc(8,8,0) tyApp e t = noExt HsAppType e' t'@@ -210,6 +234,14 @@   where     recField :: (RdrNameStr, HsExpr') -> LHsRecField' LHsExpr'     recField (f, e) =+#if MIN_VERSION_ghc(9,4,0)+        mkLocated HsFieldBind+            { hfbLHS =+                  mkLocated $ withPlaceHolder $ noExt FieldOcc $ valueRdrName f+            , hfbRHS = mkLocated e+            , hfbPun = False+            , hfbAnn = EpAnnNotUsed+#else         mkLocated HsRecField             { hsRecFieldLbl =                   builtLoc $ withPlaceHolder $ noExt FieldOcc $ valueRdrName f@@ -218,6 +250,7 @@ #if MIN_VERSION_ghc(9,2,0)             , hsRecFieldAnn = EpAnnNotUsed #endif+#endif             }  -- | Updates a record expression with explicit field names.@@ -241,6 +274,14 @@   where     mkField :: (RdrNameStr, HsExpr') -> LHsRecUpdField'     mkField (f, e') =+#if MIN_VERSION_ghc(9,4,0)+        mkLocated HsFieldBind+            { hfbLHS =+                mkLocated $ withPlaceHolder $ noExt Ambiguous $ valueRdrName f+            , hfbRHS = mkLocated e'+            , hfbPun = False+            , hfbAnn = EpAnnNotUsed+#else         mkLocated HsRecField             { hsRecFieldLbl =                 builtLoc $ withPlaceHolder $ noExt Ambiguous $ valueRdrName f@@ -248,6 +289,7 @@             , hsRecPun = False #if MIN_VERSION_ghc(9,2,0)             , hsRecFieldAnn = EpAnnNotUsed+#endif #endif             }     withPlaceHolder4 = withPlaceHolder . withPlaceHolder . withPlaceHolder
src/GHC/SourceGen/Expr/Internal.hs view
@@ -17,6 +17,10 @@ import GHC.SourceGen.Lit.Internal import GHC.SourceGen.Syntax.Internal +#if MIN_VERSION_ghc(9,4,0)+import Language.Haskell.Syntax.Extension+#endif+ parenthesizeExprForApp, parenthesizeExprForOp     :: LHsExpr' -> LHsExpr' parenthesizeExprForApp e @@ -27,7 +31,11 @@     | otherwise = e  parExpr :: LHsExpr' -> LHsExpr'+#if MIN_VERSION_ghc(9,4,0)+parExpr e = mkLocated $ withEpAnnNotUsed HsPar mkToken e mkToken+#else parExpr = mkLocated . withEpAnnNotUsed HsPar+#endif  #if MIN_VERSION_ghc(8,6,0) #define WILD_EXT _
src/GHC/SourceGen/Lit.hs view
@@ -45,7 +45,11 @@ instance HasLit Pat' where     lit = noExt LitPat     overLit l = withPlaceHolder+#if MIN_VERSION_ghc(9,4,0)+                    $ withEpAnnNotUsed NPat (mkLocated l) Nothing noSyntaxExpr+#else                     $ withEpAnnNotUsed NPat (builtLoc l) Nothing noSyntaxExpr+#endif  char :: HasLit e => Char -> e char = lit . noSourceText HsChar@@ -55,13 +59,21 @@  -- | Note: this is an *overloaded* integer. int :: HasLit e => Integer -> e+#if MIN_VERSION_ghc(9,4,0)+int n = overLit $ withPlaceHolder $ withPlaceHolder (noExt OverLit n')+#else int n = overLit $ withPlaceHolder $ withPlaceHolder (noExt OverLit n') noExpr+#endif   where     n' = HsIntegral $ mkIntegralLit n  -- | Note: this is an *overloaded* rational, e.g., a decimal number. frac :: HasLit e => Rational -> e+#if MIN_VERSION_ghc(9,4,0)+frac x = overLit $ withPlaceHolder $ withPlaceHolder (noExt OverLit $ HsFractional x')+#else frac x = overLit $ withPlaceHolder $ withPlaceHolder (noExt OverLit $ HsFractional x') noExpr+#endif   where #if MIN_VERSION_ghc(9,2,0)     x' = mkTHFractionalLit x
src/GHC/SourceGen/Module.hs view
@@ -26,7 +26,14 @@     , moduleContents     )  where -import GHC.Hs.ImpExp (LIEWrappedName, IEWildcard(..), IEWrappedName(..), IE(..))+import GHC.Hs.ImpExp+    ( IEWildcard(..), IEWrappedName(..), IE(..)+#if MIN_VERSION_ghc(9,6,0)+    , ImportListInterpretation (EverythingBut, Exactly), XImportDeclPass (ideclSourceText, ideclImplicit)+#else+    , LIEWrappedName+#endif+    ) import GHC.Hs     ( HsModule(..)     , ImportDecl(..)@@ -36,19 +43,34 @@ #if MIN_VERSION_ghc(9,2,0)     , EpAnn(..) #endif+#if MIN_VERSION_ghc(9,6,0)+    , hsmodDeprecMessage, hsmodHaddockModHeader, hsmodAnn, AnnKeywordId, XModulePs (XModulePs, hsmodLayout), noAnn, LayoutInfo (NoLayoutInfo), GhcPs, XImportDeclPass (XImportDeclPass, ideclAnn), SrcSpanAnnA, noExtField+#endif     )-#if MIN_VERSION_ghc(9,0,0)+#if MIN_VERSION_ghc(9,0,0) && !MIN_VERSION_ghc(9,6,0) import GHC.Types.SrcLoc (LayoutInfo(..))+#endif+#if MIN_VERSION_ghc(9,0,0) import GHC.Unit.Module (IsBootInterface(..)) import GHC.Types.Name.Reader (RdrName) #else import RdrName (RdrName) #endif+#if MIN_VERSION_ghc(9,4,0)+import GHC.Types.PkgQual (RawPkgQual(..))+#endif  import GHC.SourceGen.Syntax.Internal-import GHC.SourceGen.Name import GHC.SourceGen.Name.Internal import GHC.SourceGen.Lit.Internal (noSourceText)+#if MIN_VERSION_ghc(9,0,0)+import GHC.SourceGen.Name (unqual)+#endif+#if MIN_VERSION_ghc(9,4,0)+import GHC.SourceGen.Name (RdrNameStr, ModuleNameStr(unModuleNameStr), OccNameStr)+import GHC.Types.SourceText (SourceText(NoSourceText))+import GHC.Types.SrcLoc (GenLocated)+#endif  module'     :: Maybe ModuleNameStr@@ -61,13 +83,21 @@     , hsmodExports = fmap (mkLocated . map mkLocated) exports     , hsmodImports = map mkLocated imports     , hsmodDecls = fmap mkLocated decls+#if MIN_VERSION_ghc(9,6,0)+    , hsmodExt = XModulePs+      { hsmodAnn = noAnn+      , hsmodLayout = NoLayoutInfo+      , hsmodDeprecMessage = Nothing+      , hsmodHaddockModHeader = Nothing }+#else     , hsmodDeprecMessage = Nothing     , hsmodHaddockModHeader = Nothing-#if MIN_VERSION_ghc(9,0,0)+#  if MIN_VERSION_ghc(9,0,0)     , hsmodLayout = NoLayoutInfo-#endif-#if MIN_VERSION_ghc(9,2,0)+#  endif+#  if MIN_VERSION_ghc(9,2,0)     , hsmodAnn = EpAnnNotUsed+#  endif #endif     } @@ -84,9 +114,13 @@ as' d m = d { ideclAs = Just (mkLocated $ unModuleNameStr m) }  import' :: ModuleNameStr -> ImportDecl'-import' m = noSourceText (withEpAnnNotUsed ImportDecl)+import' m = importDecl             (mkLocated $ unModuleNameStr m)+#if MIN_VERSION_ghc(9,4,0)+            NoRawPkgQual+#else             Nothing+#endif #if MIN_VERSION_ghc(9,0,0)             NotBoot #else@@ -98,15 +132,36 @@ #else             False #endif-            False Nothing Nothing+#if !MIN_VERSION_ghc(9,6,0)+            False+#endif+            Nothing Nothing+  where+#if MIN_VERSION_ghc(9,6,0)+    importDecl = ImportDecl+            (XImportDeclPass{ ideclAnn = EpAnnNotUsed+            , ideclSourceText = NoSourceText+            , ideclImplicit = False+             })+#else+    importDecl = noSourceText (withEpAnnNotUsed ImportDecl)+#endif  exposing :: ImportDecl' -> [IE'] -> ImportDecl' exposing d ies = d+#if MIN_VERSION_ghc(9,6,0)+    { ideclImportList = Just (Exactly, mkLocated $ map mkLocated ies) }+#else     { ideclHiding = Just (False, mkLocated $ map mkLocated ies) }+#endif  hiding :: ImportDecl' -> [IE'] -> ImportDecl' hiding d ies = d+#if MIN_VERSION_ghc(9,6,0)+    { ideclImportList = Just (EverythingBut, mkLocated $ map mkLocated ies) }+#else     { ideclHiding = Just (True, mkLocated $ map mkLocated ies) }+#endif  -- | Adds the @{-# SOURCE #-}@ pragma to an import. source :: ImportDecl' -> ImportDecl'@@ -143,8 +198,13 @@  -- TODO: support "mixed" syntax with both ".." and explicit names. +#if MIN_VERSION_ghc(9,6,0)+wrappedName :: RdrNameStr -> GenLocated SrcSpanAnnA (IEWrappedName GhcPs)+wrappedName rNameStr = mkLocated (IEName noExtField $ exportRdrName rNameStr)+#else wrappedName :: RdrNameStr -> LIEWrappedName RdrName wrappedName = mkLocated . IEName . exportRdrName+#endif  -- | Exports an entire module. --
src/GHC/SourceGen/Overloaded.hs view
@@ -22,7 +22,11 @@     ( HsType(..)     , HsTyVarBndr(..)     )-import GHC.Hs (IE(..), IEWrappedName(..))+import GHC.Hs (IE(..), IEWrappedName(..)+#if MIN_VERSION_ghc(9,6,0)+    , noExtField+#endif+    ) #if !MIN_VERSION_ghc(8,6,0) import PlaceHolder(PlaceHolder(..)) #endif@@ -56,10 +60,18 @@     par :: e -> e  instance Par HsExpr' where+#if MIN_VERSION_ghc(9,4,0)+    par p = withEpAnnNotUsed HsPar mkToken (mkLocated p) mkToken+#else     par = withEpAnnNotUsed HsPar . mkLocated+#endif  instance Par Pat' where+#if MIN_VERSION_ghc(9,4,0)+    par p = withEpAnnNotUsed ParPat mkToken (builtPat p) mkToken+#else     par = withEpAnnNotUsed ParPat . builtPat+#endif  instance Par HsType' where     par = withEpAnnNotUsed HsParTy . mkLocated@@ -139,9 +151,15 @@  instance App HsType' where     op x o y+#if MIN_VERSION_ghc(9,4,0)+        = withEpAnnNotUsed HsOpTy notPromoted (parenthesizeTypeForOp $ mkLocated x)+                (typeRdrName o)+                (parenthesizeTypeForOp $ mkLocated y)+#else         = noExt HsOpTy (parenthesizeTypeForOp $ mkLocated x)                 (typeRdrName o)                 (parenthesizeTypeForOp $ mkLocated y)+#endif     x @@ y = noExt HsAppTy                 (parenthesizeTypeForOp $ mkLocated x)                 (parenthesizeTypeForApp $ mkLocated y)@@ -272,8 +290,14 @@ #endif  instance Var IE' where-    var n = noExt IEVar $ mkLocated $ IEName $ exportRdrName n+    var n =+      noExt IEVar $ mkLocated $+#if MIN_VERSION_ghc(9,6,0)+      (IEName noExtField)+#else+      IEName+#endif+      $ exportRdrName n  instance BVar IE' where     bvar = var . UnqualStr-
src/GHC/SourceGen/Pat.hs view
@@ -29,6 +29,9 @@ #if MIN_VERSION_ghc(9,2,0) import GHC.Parser.Annotation (EpAnn(..)) #endif+#if MIN_VERSION_ghc(9,6,0)+import GHC (noHsTok)+#endif  -- | A wild pattern (@_@). wildP :: Pat'@@ -40,7 +43,12 @@ -- > ===== -- > asP "a" (var "B") asP :: RdrNameStr -> Pat' -> Pat'-v `asP` p = withEpAnnNotUsed AsPat (valueRdrName v) $ builtPat $ parenthesize p+v `asP` p =+  withEpAnnNotUsed AsPat (valueRdrName v)+#if MIN_VERSION_ghc(9,6,0)+  noHsTok+#endif+  (builtPat $ parenthesize p)  -- | A pattern constructor. --@@ -81,6 +89,13 @@   where     mkRecField :: (RdrNameStr, Pat') -> LHsRecField' LPat'     mkRecField (f, p) =+#if MIN_VERSION_ghc(9,4,0)+        mkLocated $ HsFieldBind+            { hfbAnn = EpAnnNotUsed+            , hfbLHS = mkLocated $ withPlaceHolder $ noExt FieldOcc $ valueRdrName f+            , hfbRHS = builtPat p+            , hfbPun = False+#else         mkLocated $ HsRecField             { hsRecFieldLbl =                 builtLoc $ withPlaceHolder $ noExt FieldOcc $ valueRdrName f@@ -88,6 +103,7 @@             , hsRecPun = False #if MIN_VERSION_ghc(9,2,0)             , hsRecFieldAnn = EpAnnNotUsed+#endif #endif             } 
src/GHC/SourceGen/Pat/Internal.hs view
@@ -51,5 +51,9 @@ needsPar _ = False  parPat :: Pat' -> Pat'+#if MIN_VERSION_ghc(9,4,0)+parPat p = withEpAnnNotUsed ParPat mkToken (builtPat p) mkToken+#else parPat = withEpAnnNotUsed ParPat . builtPat+#endif 
src/GHC/SourceGen/Syntax/Internal.hs view
@@ -62,7 +62,7 @@ import SrcLoc (SrcSpan, Located, GenLocated(..), mkGeneralSrcSpan) #endif -#if MIN_VERSION_ghc(9,2,0)+#if MIN_VERSION_ghc(9,2,0) && !MIN_VERSION_ghc(9,6,0) import GHC.Parser.Annotation     ( SrcSpanAnn'(..)     , AnnSortKey(..)@@ -93,6 +93,10 @@ import GHC.Types.Var (Specificity) #endif +#if MIN_VERSION_ghc(9,4,0)+import GHC.Parser.Annotation+#endif+ import GHC.Hs.Extension (GhcPs)  #if MIN_VERSION_ghc(8,10,0)@@ -286,7 +290,7 @@ #endif  type HsLit' = HsLit GhcPs-#if MIN_VERSION_ghc(9,0,0)+#if MIN_VERSION_ghc(9,0,0) && !MIN_VERSION_ghc(9,6,0) type HsModule' = HsModule #else type HsModule' = HsModule GhcPs@@ -339,4 +343,14 @@ type LIdP = GHC.LIdP GHC.GhcPs #else type LIdP = Located (GHC.IdP GHC.GhcPs)+#endif++#if MIN_VERSION_ghc(9,4,0)+mkUniToken :: GenLocated TokenLocation (GHC.HsUniToken t u)+mkUniToken = L NoTokenLoc GHC.HsNormalTok+#endif++#if MIN_VERSION_ghc(9,4,0)+mkToken :: GenLocated TokenLocation (GHC.HsToken t)+mkToken = L NoTokenLoc GHC.HsTok #endif
src/GHC/SourceGen/Type.hs view
@@ -29,6 +29,10 @@ import GHC.Hs.Type #endif +#if MIN_VERSION_ghc(9,4,0)+import Language.Haskell.Syntax.Extension+#endif+ import GHC.SourceGen.Syntax.Internal import GHC.SourceGen.Lit.Internal (noSourceText) import GHC.SourceGen.Name.Internal@@ -62,7 +66,9 @@ -- > var "a" --> var "b" (-->) :: HsType' -> HsType' -> HsType' a --> b = withEpAnnNotUsed HsFunTy-#if MIN_VERSION_ghc(9,0,0)+#if MIN_VERSION_ghc(9,4,0)+         (HsUnrestrictedArrow mkUniToken)+#elif MIN_VERSION_ghc(9,0,0)          (HsUnrestrictedArrow NormalSyntax) #endif          (parenthesizeTypeForFun $ mkLocated a) (mkLocated b)@@ -96,7 +102,9 @@ (==>) :: [HsType'] -> HsType' -> HsType' (==>) cs = hsQualTy (mkLocated (map mkLocated cs)) . mkLocated   where-#if MIN_VERSION_ghc(9,2,0)+#if MIN_VERSION_ghc(9,4,0)+    hsQualTy = noExt HsQualTy +#elif MIN_VERSION_ghc(9,2,0)     hsQualTy = noExt HsQualTy . Just #else     hsQualTy = noExt HsQualTy