{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
module Graph.Trace.Internal.GhcFacade
  ( module Ghc
  , enumSetMember
  , pattern FunBind'
  , fun_ext'
  , fun_id'
  , fun_matches'
  , pattern HsSig'
  , setSigBody
  , noLocA'
  , emptyEpAnn
  , noLoc'
  , emptyComments'
  , pattern HsQualTy'
  , pattern RealSrcLoc'
  , pattern L'
  ) where

#if MIN_VERSION_ghc(9,2,0)
import GHC.Builtin.Names as Ghc
import GHC.Builtin.Types as Ghc
import GHC.Core.Class as Ghc
import GHC.Core.Make as Ghc
import GHC.Core.Type as Ghc
import GHC.Data.Bag as Ghc
import qualified GHC.Data.EnumSet as EnumSet
import GHC.Data.FastString as Ghc
import GHC.Driver.Plugins as Ghc hiding (TcPlugin)
import GHC.Driver.Session as Ghc
import GHC.Hs as Ghc hiding (FunDep)
import GHC.Iface.Env as Ghc
import GHC.LanguageExtensions as Ghc hiding (UnicodeSyntax)
import GHC.Rename.Expr as Ghc
import GHC.Tc.Types as Ghc
import GHC.Tc.Types.Constraint as Ghc
import GHC.Tc.Types.Evidence as Ghc
import GHC.Tc.Types.Origin as Ghc
import GHC.Tc.Utils.Monad as Ghc
import GHC.ThToHs as Ghc
import GHC.Types.Basic as Ghc
import GHC.Types.Fixity as Ghc
import GHC.Types.Name as Ghc hiding (varName)
import GHC.Types.SrcLoc as Ghc
import GHC.Types.Unique.Supply as Ghc
import GHC.Unit.Finder as Ghc
import GHC.Unit.Module.Name as Ghc
import GHC.Unit.Types as Ghc
import GHC.Utils.Outputable as Ghc

#elif MIN_VERSION_ghc(9,0,0)
import GHC.Builtin.Names as Ghc
import GHC.Builtin.Types as Ghc
import GHC.Core.Class as Ghc
import GHC.Core.Make as Ghc
import GHC.Core.Type as Ghc
import GHC.Data.Bag as Ghc
import qualified GHC.Data.EnumSet as EnumSet
import GHC.Data.FastString as Ghc
import GHC.Driver.Finder as Ghc
import GHC.Driver.Plugins as Ghc hiding (TcPlugin)
import GHC.Driver.Session as Ghc
import GHC.Hs.Binds as Ghc
import GHC.Hs.Decls as Ghc
import GHC.Hs.Expr as Ghc
import GHC.Hs.Extension as Ghc
import GHC.Hs.Pat as Ghc
import GHC.Hs.Type as Ghc
import GHC.Iface.Env as Ghc
import GHC.LanguageExtensions as Ghc hiding (UnicodeSyntax)
import GHC.Rename.Expr as Ghc
import GHC.Tc.Types as Ghc
import GHC.Tc.Types.Constraint as Ghc
import GHC.Tc.Types.Evidence as Ghc
import GHC.Tc.Types.Origin as Ghc
import GHC.Tc.Utils.Monad as Ghc
import GHC.ThToHs as Ghc
import GHC.Types.Basic as Ghc
import GHC.Types.Name as Ghc hiding (varName)
import GHC.Types.SrcLoc as Ghc
import GHC.Types.Unique.Supply as Ghc
import GHC.Unit.Module.Name as Ghc
import GHC.Unit.Types as Ghc
import GHC.Utils.Outputable as Ghc

#elif MIN_VERSION_ghc(8,10,0)
import Bag as Ghc
import BasicTypes as Ghc
import Class as Ghc
import Constraint as Ghc
import DynFlags as Ghc
import qualified EnumSet as EnumSet
import FastString as Ghc
import Finder as Ghc
import GHC.Hs.Binds as Ghc
import GHC.Hs.Decls as Ghc
import GHC.Hs.Expr as Ghc
import GHC.Hs.Extension as Ghc
import GHC.Hs.Pat as Ghc
import GHC.Hs.Types as Ghc
import GHC.LanguageExtensions as Ghc hiding (UnicodeSyntax)
import GHC.ThToHs as Ghc
import IfaceEnv as Ghc
import MkCore as Ghc
import Module as Ghc
import Name as Ghc
import Outputable as Ghc
import Plugins as Ghc hiding (TcPlugin)
import PrelNames as Ghc
import RnExpr as Ghc
import SrcLoc as Ghc
import TcEvidence as Ghc
import TcOrigin as Ghc
import TcPluginM as Ghc hiding (findImportedModule, getTopEnv, newUnique, getEnvs, lookupOrig)
import TcRnMonad as Ghc
import Type as Ghc
import TysWiredIn as Ghc
import UniqSupply as Ghc
#endif

enumSetMember :: Enum a => a -> EnumSet.EnumSet a -> Bool
enumSetMember :: a -> EnumSet a -> Bool
enumSetMember = a -> EnumSet a -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
EnumSet.member

pattern $bFunBind' :: XFunBind GhcRn GhcRn
-> Located (IdP GhcRn)
-> MatchGroup GhcRn (LHsExpr GhcRn)
-> HsBindLR GhcRn GhcRn
$mFunBind' :: forall r.
HsBindLR GhcRn GhcRn
-> (XFunBind GhcRn GhcRn
    -> Located (IdP GhcRn) -> MatchGroup GhcRn (LHsExpr GhcRn) -> r)
-> (Void# -> r)
-> r
FunBind'
  { HsBindLR GhcRn GhcRn -> XFunBind GhcRn GhcRn
fun_ext'
  , HsBindLR GhcRn GhcRn -> Located (IdP GhcRn)
fun_id'
  , HsBindLR GhcRn GhcRn -> MatchGroup GhcRn (LHsExpr GhcRn)
fun_matches'
  } =
#if MIN_VERSION_ghc(9,0,0)
    FunBind fun_ext' fun_id' fun_matches' []
pattern FunBind'
  :: XFunBind GhcRn GhcRn
  -> LIdP GhcRn
  -> MatchGroup GhcRn (LHsExpr GhcRn)
  -> HsBindLR GhcRn GhcRn
#else
    FunBind fun_ext' fun_id' fun_matches' WpHole []
pattern FunBind'
  :: XFunBind GhcRn GhcRn
  -> Located (IdP GhcRn)
  -> MatchGroup GhcRn (LHsExpr GhcRn)
  -> HsBindLR GhcRn GhcRn
#endif

pattern $bHsSig' :: LHsType GhcRn -> HsImplicitBndrs GhcRn (LHsType GhcRn)
$mHsSig' :: forall r.
HsImplicitBndrs GhcRn (LHsType GhcRn)
-> (LHsType GhcRn -> r) -> (Void# -> r) -> r
HsSig' ty
#if MIN_VERSION_ghc(9,2,0)
  <- L _ (HsSig _ _ ty)
    where
      HsSig' ty = L noSrcSpanA $ HsSig NoExtField (HsOuterImplicit []) ty
pattern HsSig' :: LHsType GhcRn -> LHsSigType Ghc.GhcRn
#else
  <- HsIB _ ty
    where
      HsSig' LHsType GhcRn
ty = XHsIB GhcRn (LHsType GhcRn)
-> LHsType GhcRn -> HsImplicitBndrs GhcRn (LHsType GhcRn)
forall pass thing.
XHsIB pass thing -> thing -> HsImplicitBndrs pass thing
HsIB [] LHsType GhcRn
ty
pattern HsSig' :: LHsType GhcRn -> HsImplicitBndrs GhcRn (LHsType GhcRn)
#endif

setSigBody :: LHsType GhcRn -> LHsSigType GhcRn -> LHsSigType GhcRn
setSigBody :: LHsType GhcRn
-> HsImplicitBndrs GhcRn (LHsType GhcRn)
-> HsImplicitBndrs GhcRn (LHsType GhcRn)
setSigBody LHsType GhcRn
body HsImplicitBndrs GhcRn (LHsType GhcRn)
lsig =
#if MIN_VERSION_ghc(9,2,0)
  fmap (\s -> s { sig_body = body }) lsig
#else
  HsImplicitBndrs GhcRn (LHsType GhcRn)
lsig { hsib_body :: LHsType GhcRn
hsib_body = LHsType GhcRn
body }
#endif

noLocA'
#if MIN_VERSION_ghc(9,2,0)
  :: a -> LocatedAn an a
noLocA'
  = noLocA
#else
  :: a -> Located a
noLocA' :: a -> Located a
noLocA'
  = a -> Located a
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc
#endif

emptyEpAnn
#if MIN_VERSION_ghc(9,2,0)
  :: EpAnn a
emptyEpAnn
  = noAnn
#else
  :: NoExtField
emptyEpAnn :: NoExtField
emptyEpAnn
  = NoExtField
NoExtField
#endif

noLoc'
#if MIN_VERSION_ghc(9,2,0)
  :: a -> a
noLoc' = id
#else
  :: a -> Located a
noLoc' :: a -> Located a
noLoc' = a -> Located a
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc
#endif

emptyComments'
#if MIN_VERSION_ghc(9,2,0)
  :: EpAnnComments
emptyComments' = emptyComments
#else
  :: NoExtField
emptyComments' :: NoExtField
emptyComments' = NoExtField
NoExtField
#endif

pattern HsQualTy'
  :: XQualTy GhcRn
  -> Maybe (LHsContext GhcRn)
  -> LHsType GhcRn
  -> HsType GhcRn
#if MIN_VERSION_ghc(9,2,0)
pattern HsQualTy' x lctx body
  = HsQualTy x lctx body
#else
pattern $bHsQualTy' :: XQualTy GhcRn
-> Maybe (LHsContext GhcRn) -> LHsType GhcRn -> HsType GhcRn
$mHsQualTy' :: forall r.
HsType GhcRn
-> (XQualTy GhcRn
    -> Maybe (LHsContext GhcRn) -> LHsType GhcRn -> r)
-> (Void# -> r)
-> r
HsQualTy' x lctx body
  <- HsQualTy x (Just -> lctx) body
    where
      HsQualTy' XQualTy GhcRn
x Maybe (LHsContext GhcRn)
Nothing LHsType GhcRn
body = XQualTy GhcRn -> LHsContext GhcRn -> LHsType GhcRn -> HsType GhcRn
forall pass.
XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
HsQualTy XQualTy GhcRn
x (SrcSpanLess (LHsContext GhcRn) -> LHsContext GhcRn
forall a. HasSrcSpan a => SrcSpanLess a -> a
noLoc []) LHsType GhcRn
body
      HsQualTy' XQualTy GhcRn
x (Just LHsContext GhcRn
lctx) LHsType GhcRn
body = XQualTy GhcRn -> LHsContext GhcRn -> LHsType GhcRn -> HsType GhcRn
forall pass.
XQualTy pass -> LHsContext pass -> LHsType pass -> HsType pass
HsQualTy XQualTy GhcRn
x LHsContext GhcRn
lctx LHsType GhcRn
body
#endif

pattern RealSrcLoc' :: RealSrcLoc -> SrcLoc
#if MIN_VERSION_ghc(9,0,0)
pattern RealSrcLoc' loc <- RealSrcLoc loc _
#else
pattern $bRealSrcLoc' :: RealSrcLoc -> SrcLoc
$mRealSrcLoc' :: forall r. SrcLoc -> (RealSrcLoc -> r) -> (Void# -> r) -> r
RealSrcLoc' loc = RealSrcLoc loc
#endif

pattern L' :: SrcSpan -> a
#if MIN_VERSION_ghc(9,2,0)
           -> GenLocated (SrcSpanAnn' ann) a
pattern L' ss a <- L (SrcSpanAnn _ ss) a
#else
           -> Located a
pattern $mL' :: forall r a. Located a -> (SrcSpan -> a -> r) -> (Void# -> r) -> r
L' ss a <- L ss a
#endif