{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE CPP #-} module Debug.Breakpoint.GhcFacade ( module Ghc , liftedRepName , LexicalFastString' , mkLexicalFastString , fromLexicalFastString , collectHsBindBinders' , collectPatBinders' , noLocA' , locA' , mkWildValBinder' , pattern HsLet' , pattern LetStmt' , pattern ExplicitList' , pattern BindStmt' ) where #if MIN_VERSION_ghc(9,2,0) import GHC.Driver.Plugins as Ghc hiding (TcPlugin) import GHC.Hs.Extension as Ghc import Language.Haskell.Syntax as Ghc import GHC.Tc.Types as Ghc import GHC.Parser.Annotation as Ghc import GHC.Types.SrcLoc as Ghc import GHC.Types.Name as Ghc import GHC.Iface.Env as Ghc import GHC.Unit.Finder as Ghc import GHC.Unit.Module.Name as Ghc import GHC.Tc.Utils.Monad as Ghc hiding (TcPlugin) import GHC.Data.FastString as Ghc import GHC.Hs.Utils as Ghc import GHC.Types.Unique.Set as Ghc import GHC.Utils.Outputable as Ghc import GHC.Hs.Binds as Ghc import GHC.Rename.Bind as Ghc import GHC.Data.Bag as Ghc import GHC.Types.Basic as Ghc import GHC.Types.Name.Env as Ghc import GHC.Builtin.Types as Ghc import GHC.Core.TyCo.Rep as Ghc import GHC.Tc.Types.Constraint as Ghc import GHC.Core.Make as Ghc import GHC.Tc.Types.Evidence as Ghc import GHC.Types.Id as Ghc import GHC.Core.InstEnv as Ghc import GHC.Core.Class as Ghc hiding (FunDep) import GHC.Tc.Utils.TcType as Ghc import GHC.Core.Type as Ghc import GHC.Core.TyCon as Ghc import GHC.Types.TyThing.Ppr as Ghc import GHC.Hs.Expr as Ghc #elif MIN_VERSION_ghc(9,0,0) import GHC.Driver.Plugins as Ghc hiding (TcPlugin) import GHC.Driver.Finder as Ghc import GHC.Hs.Extension as Ghc import GHC.Tc.Types as Ghc import GHC.Parser.Annotation as Ghc import GHC.Types.SrcLoc as Ghc import GHC.Types.Name as Ghc import GHC.Iface.Env as Ghc import GHC.Unit.Module.Name as Ghc import GHC.Tc.Utils.Monad as Ghc hiding (TcPlugin) import GHC.Data.FastString as Ghc import GHC.Hs.Utils as Ghc import GHC.Types.Unique.Set as Ghc import GHC.Utils.Outputable as Ghc import GHC.Hs.Binds as Ghc import GHC.Rename.Bind as Ghc import GHC.Data.Bag as Ghc import GHC.Types.Basic as Ghc import GHC.Types.Name.Env as Ghc import GHC.Builtin.Types as Ghc import GHC.Core.TyCo.Rep as Ghc import GHC.Tc.Types.Constraint as Ghc import GHC.Core.Make as Ghc import GHC.Tc.Types.Evidence as Ghc import GHC.Types.Id as Ghc import GHC.Core.InstEnv as Ghc import GHC.Core.Class as Ghc hiding (FunDep) import GHC.Tc.Utils.TcType as Ghc import GHC.Core.Type as Ghc import GHC.Core.TyCon as Ghc import GHC.Core.Ppr.TyThing as Ghc import GHC.Driver.Types as Ghc import GHC.Hs.Expr as Ghc import GHC.Hs.Pat as Ghc import GHC.Hs.Decls as Ghc #elif MIN_VERSION_ghc(8,10,0) import GHC.Hs.Expr as Ghc import GHC.Hs.Extension as Ghc import GHC.Hs.Binds as Ghc import SrcLoc as Ghc import GHC.Hs.Utils as Ghc import Name as Ghc import GHC.Hs.Pat as Ghc import FastString as Ghc import TysWiredIn as Ghc import InstEnv as Ghc import TcEvidence as Ghc import TyCoRep as Ghc import MkCore as Ghc import PprTyThing as Ghc import Outputable as Ghc import TcRnTypes as Ghc import Type as Ghc import TcType as Ghc import Id as Ghc import Class as Ghc import Constraint as Ghc import Module as Ghc import HscTypes as Ghc import TyCon as Ghc import Bag as Ghc import BasicTypes as Ghc import UniqSet as Ghc import NameEnv as Ghc import IfaceEnv as Ghc import Finder as Ghc hiding (findImportedModule) import TcPluginM as Ghc hiding (lookupOrig, getTopEnv, getEnvs, newUnique) import GHC.Hs.Decls as Ghc import TcRnMonad as Ghc import Plugins as Ghc hiding (TcPlugin) #endif liftedRepName :: Ghc.Name #if MIN_VERSION_ghc(9,2,0) liftedRepName :: Name liftedRepName = TyCon -> Name forall a. NamedThing a => a -> Name Ghc.getName TyCon Ghc.liftedRepTyCon #else liftedRepName = Ghc.getName Ghc.liftedRepDataCon #endif #if MIN_VERSION_ghc(9,2,0) type LexicalFastString' = Ghc.LexicalFastString #else type LexicalFastString' = Ghc.FastString #endif mkLexicalFastString :: Ghc.FastString -> LexicalFastString' fromLexicalFastString :: LexicalFastString' -> Ghc.FastString #if MIN_VERSION_ghc(9,2,0) mkLexicalFastString :: FastString -> LexicalFastString' mkLexicalFastString = FastString -> LexicalFastString' Ghc.LexicalFastString fromLexicalFastString :: LexicalFastString' -> FastString fromLexicalFastString (Ghc.LexicalFastString FastString fs) = FastString fs #else mkLexicalFastString = id fromLexicalFastString = id #endif collectHsBindBinders' :: Ghc.HsBindLR Ghc.GhcRn idR -> [Ghc.Name] collectHsBindBinders' :: forall idR. HsBindLR GhcRn idR -> [Name] collectHsBindBinders' = CollectFlag GhcRn -> HsBindLR GhcRn idR -> [IdP GhcRn] forall p idR. CollectPass p => CollectFlag p -> HsBindLR p idR -> [IdP p] Ghc.collectHsBindBinders #if MIN_VERSION_ghc(9,2,0) CollectFlag GhcRn forall p. CollectFlag p Ghc.CollNoDictBinders #endif collectPatBinders' :: Ghc.LPat Ghc.GhcRn -> [Ghc.Name] collectPatBinders' :: LPat GhcRn -> [Name] collectPatBinders' = CollectFlag GhcRn -> LPat GhcRn -> [IdP GhcRn] forall p. CollectPass p => CollectFlag p -> LPat p -> [IdP p] Ghc.collectPatBinders #if MIN_VERSION_ghc(9,2,0) CollectFlag GhcRn forall p. CollectFlag p Ghc.CollNoDictBinders #endif noLocA' #if MIN_VERSION_ghc(9,2,0) :: a -> LocatedAn an a noLocA' :: forall a an. a -> LocatedAn an a noLocA' = a -> LocatedAn an a forall a an. a -> LocatedAn an a noLocA #else :: a -> Located a noLocA' = noLoc #endif #if MIN_VERSION_ghc(9,2,0) locA' :: Ghc.SrcSpanAnn' ann -> Ghc.SrcSpan locA' :: forall ann. SrcSpanAnn' ann -> SrcSpan locA' = SrcSpanAnn' ann -> SrcSpan forall ann. SrcSpanAnn' ann -> SrcSpan Ghc.locA #else locA' :: Ghc.SrcSpan -> Ghc.SrcSpan locA' = id #endif mkWildValBinder' :: Ghc.Type -> Ghc.Id #if MIN_VERSION_ghc(9,0,0) mkWildValBinder' :: Type -> Id mkWildValBinder' = Type -> Type -> Id Ghc.mkWildValBinder Type Ghc.oneDataConTy #else mkWildValBinder' = Ghc.mkWildValBinder #endif pattern HsLet' :: Ghc.XLet Ghc.GhcRn -> Ghc.Located (Ghc.HsLocalBinds Ghc.GhcRn) -> Ghc.LHsExpr Ghc.GhcRn -> Ghc.HsExpr Ghc.GhcRn #if MIN_VERSION_ghc(9,2,0) pattern $bHsLet' :: XLet GhcRn -> Located (HsLocalBinds GhcRn) -> LHsExpr GhcRn -> HsExpr GhcRn $mHsLet' :: forall {r}. HsExpr GhcRn -> (XLet GhcRn -> Located (HsLocalBinds GhcRn) -> LHsExpr GhcRn -> r) -> ((# #) -> r) -> r HsLet' x lbinds expr <- Ghc.HsLet x (Ghc.L Ghc.noSrcSpan -> lbinds) expr where HsLet' XLet GhcRn x (Ghc.L SrcSpan _ HsLocalBinds GhcRn binds) LHsExpr GhcRn expr = XLet GhcRn -> HsLocalBinds GhcRn -> LHsExpr GhcRn -> HsExpr GhcRn forall p. XLet p -> HsLocalBinds p -> LHsExpr p -> HsExpr p Ghc.HsLet XLet GhcRn x HsLocalBinds GhcRn binds LHsExpr GhcRn expr #else pattern HsLet' x lbinds expr = Ghc.HsLet x lbinds expr #endif pattern LetStmt' :: XLetStmt Ghc.GhcRn Ghc.GhcRn body -> Ghc.Located (HsLocalBinds Ghc.GhcRn) -> Ghc.StmtLR Ghc.GhcRn Ghc.GhcRn body #if MIN_VERSION_ghc(9,2,0) pattern $bLetStmt' :: forall body. XLetStmt GhcRn GhcRn body -> Located (HsLocalBinds GhcRn) -> StmtLR GhcRn GhcRn body $mLetStmt' :: forall {r} {body}. StmtLR GhcRn GhcRn body -> (XLetStmt GhcRn GhcRn body -> Located (HsLocalBinds GhcRn) -> r) -> ((# #) -> r) -> r LetStmt' x lbinds <- Ghc.LetStmt x (Ghc.L Ghc.noSrcSpan -> lbinds) where LetStmt' XLetStmt GhcRn GhcRn body x (Ghc.L SrcSpan _ HsLocalBinds GhcRn binds) = XLetStmt GhcRn GhcRn body -> HsLocalBinds GhcRn -> StmtLR GhcRn GhcRn body forall idL idR body. XLetStmt idL idR body -> HsLocalBindsLR idL idR -> StmtLR idL idR body Ghc.LetStmt XLetStmt GhcRn GhcRn body x HsLocalBinds GhcRn binds #else pattern LetStmt' x lbinds = Ghc.LetStmt x lbinds #endif pattern ExplicitList' :: Ghc.XExplicitList p -> [Ghc.LHsExpr p] -> Ghc.HsExpr p #if MIN_VERSION_ghc(9,2,0) pattern $bExplicitList' :: forall p. XExplicitList p -> [LHsExpr p] -> HsExpr p $mExplicitList' :: forall {r} {p}. HsExpr p -> (XExplicitList p -> [LHsExpr p] -> r) -> ((# #) -> r) -> r ExplicitList' x exprs = Ghc.ExplicitList x exprs #else pattern ExplicitList' x exprs <- Ghc.ExplicitList x _ exprs where ExplicitList' x exprs = Ghc.ExplicitList x Nothing exprs #endif #if MIN_VERSION_ghc(9,0,0) mkSyntaxExprs :: x -> (SyntaxExpr Ghc.GhcRn, SyntaxExpr Ghc.GhcRn, x) mkSyntaxExprs :: forall x. x -> (SyntaxExpr GhcRn, SyntaxExpr GhcRn, x) mkSyntaxExprs x x = (SyntaxExpr GhcRn forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p) Ghc.noSyntaxExpr, SyntaxExpr GhcRn forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p) Ghc.noSyntaxExpr, x x) #endif pattern BindStmt' :: Ghc.XBindStmt Ghc.GhcRn Ghc.GhcRn body -> Ghc.LPat Ghc.GhcRn -> body -> SyntaxExpr Ghc.GhcRn -> SyntaxExpr Ghc.GhcRn -> Ghc.Stmt Ghc.GhcRn body #if MIN_VERSION_ghc(9,0,0) pattern $bBindStmt' :: forall body. XBindStmt GhcRn GhcRn body -> LPat GhcRn -> body -> SyntaxExpr GhcRn -> SyntaxExpr GhcRn -> Stmt GhcRn body $mBindStmt' :: forall {r} {body}. Stmt GhcRn body -> (XBindStmt GhcRn GhcRn body -> LPat GhcRn -> body -> SyntaxExpr GhcRn -> SyntaxExpr GhcRn -> r) -> ((# #) -> r) -> r BindStmt' x pat body expr1 expr2 <- Ghc.BindStmt x pat (mkSyntaxExprs -> (expr1, expr2, body)) where BindStmt' XBindStmt GhcRn GhcRn body x LPat GhcRn pat body body SyntaxExpr GhcRn _ SyntaxExpr GhcRn _ = XBindStmt GhcRn GhcRn body -> LPat GhcRn -> body -> StmtLR GhcRn GhcRn body forall idL idR body. XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body Ghc.BindStmt XBindStmt GhcRn GhcRn body x LPat GhcRn pat body body #else pattern BindStmt' x pat body bindExpr failExpr = Ghc.BindStmt x pat body bindExpr failExpr #endif