{-# LANGUAGE LambdaCase #-} module Skeletest.Internal.GHC.Compat_9_8 ( module Skeletest.Internal.GHC.Compat_9_8, ) where import Data.Data (toConstr) import Data.List.NonEmpty (NonEmpty) import Data.List.NonEmpty qualified as NonEmpty import GHC hiding (FieldOcc (..), mkPrefixFunRhs) import GHC qualified import GHC.Types.Name.Reader (getRdrName) import GHC.Types.SrcLoc import Skeletest.Internal.Error (invariantViolation) hsLamSingle :: MatchGroup (GhcPass p) (LHsExpr (GhcPass p)) -> HsExpr (GhcPass p) hsLamSingle :: forall (p :: Pass). MatchGroup (GhcPass p) (LHsExpr (GhcPass p)) -> HsExpr (GhcPass p) hsLamSingle = XLam (GhcPass p) -> MatchGroup (GhcPass p) (LHsExpr (GhcPass p)) -> HsExpr (GhcPass p) forall p. XLam p -> MatchGroup p (LHsExpr p) -> HsExpr p HsLam XLam (GhcPass p) NoExtField noExtField lamAltSingle :: HsMatchContext fn lamAltSingle :: forall fn. HsMatchContext fn lamAltSingle = HsMatchContext fn forall fn. HsMatchContext fn LambdaExpr hsLit :: HsLit (GhcPass p) -> HsExpr (GhcPass p) hsLit :: forall (p :: Pass). HsLit (GhcPass p) -> HsExpr (GhcPass p) hsLit = XLitE (GhcPass p) -> HsLit (GhcPass p) -> HsExpr (GhcPass p) forall p. XLitE p -> HsLit p -> HsExpr p HsLit XLitE (GhcPass p) EpAnn NoEpAnns forall a. EpAnn a noAnn hsPar :: LHsExpr (GhcPass p) -> HsExpr (GhcPass p) hsPar :: forall (p :: Pass). LHsExpr (GhcPass p) -> HsExpr (GhcPass p) hsPar LHsExpr (GhcPass p) e = XPar (GhcPass p) -> LHsToken "(" (GhcPass p) -> LHsExpr (GhcPass p) -> LHsToken ")" (GhcPass p) -> HsExpr (GhcPass p) forall p. XPar p -> LHsToken "(" p -> LHsExpr p -> LHsToken ")" p -> HsExpr p HsPar XPar (GhcPass p) EpAnn NoEpAnns forall a. EpAnn a noAnn (TokenLocation -> HsToken "(" -> GenLocated TokenLocation (HsToken "(") forall l e. l -> e -> GenLocated l e L TokenLocation NoTokenLoc HsToken "(" forall (tok :: Symbol). HsToken tok HsTok) LHsExpr (GhcPass p) e (TokenLocation -> HsToken ")" -> GenLocated TokenLocation (HsToken ")") forall l e. l -> e -> GenLocated l e L TokenLocation NoTokenLoc HsToken ")" forall (tok :: Symbol). HsToken tok HsTok) unHsPar :: HsExpr GhcRn -> LHsExpr GhcRn unHsPar :: HsExpr GhcRn -> LHsExpr GhcRn unHsPar = \case HsPar XPar GhcRn _ LHsToken "(" GhcRn _ LHsExpr GhcRn e LHsToken ")" GhcRn _ -> LHsExpr GhcRn e HsExpr GhcRn e -> String -> LHsExpr GhcRn forall a. HasCallStack => String -> a invariantViolation (String -> LHsExpr GhcRn) -> String -> LHsExpr GhcRn forall a b. (a -> b) -> a -> b $ String "unHsPar called on " String -> String -> String forall a. Semigroup a => a -> a -> a <> (Constr -> String forall a. Show a => a -> String show (Constr -> String) -> (HsExpr GhcRn -> Constr) -> HsExpr GhcRn -> String forall b c a. (b -> c) -> (a -> b) -> a -> c . HsExpr GhcRn -> Constr forall a. Data a => a -> Constr toConstr) HsExpr GhcRn e hsTupPresent :: LHsExpr (GhcPass p) -> HsTupArg (GhcPass p) hsTupPresent :: forall (p :: Pass). LHsExpr (GhcPass p) -> HsTupArg (GhcPass p) hsTupPresent = XPresent (GhcPass p) -> LHsExpr (GhcPass p) -> HsTupArg (GhcPass p) forall id. XPresent id -> LHsExpr id -> HsTupArg id Present XPresent (GhcPass p) EpAnn [AddEpAnn] forall a. EpAnn a noAnn xMatch :: XCMatch (GhcPass p) b xMatch :: forall (p :: Pass) b. XCMatch (GhcPass p) b xMatch = XCMatch (GhcPass p) b EpAnn [AddEpAnn] forall a. EpAnn a noAnn mkHsRecFields :: [LHsRecField (GhcPass p) arg] -> HsRecFields (GhcPass p) arg mkHsRecFields :: forall (p :: Pass) arg. [LHsRecField (GhcPass p) arg] -> HsRecFields (GhcPass p) arg mkHsRecFields [LHsRecField (GhcPass p) arg] fields = GHC.HsRecFields { rec_flds :: [LHsRecField (GhcPass p) arg] rec_flds = [LHsRecField (GhcPass p) arg] fields , rec_dotdot :: Maybe (XRec (GhcPass p) RecFieldsDotDot) rec_dotdot = Maybe (XRec (GhcPass p) RecFieldsDotDot) Maybe (GenLocated SrcSpan RecFieldsDotDot) forall a. Maybe a Nothing } foLabel :: GHC.FieldOcc GhcRn -> LIdP GhcRn foLabel :: FieldOcc GhcRn -> LIdP GhcRn foLabel = Name -> GenLocated (SrcAnn NameAnn) Name forall e ann. e -> GenLocated (SrcAnn ann) e genLoc (Name -> GenLocated (SrcAnn NameAnn) Name) -> (FieldOcc GhcRn -> Name) -> FieldOcc GhcRn -> GenLocated (SrcAnn NameAnn) Name forall b c a. (b -> c) -> (a -> b) -> a -> c . FieldOcc GhcRn -> XCFieldOcc GhcRn FieldOcc GhcRn -> Name forall pass. FieldOcc pass -> XCFieldOcc pass GHC.foExt fieldOccRn :: Name -> GHC.FieldOcc GhcRn fieldOccRn :: Name -> FieldOcc GhcRn fieldOccRn Name name = GHC.FieldOcc { foExt :: XCFieldOcc GhcRn GHC.foExt = XCFieldOcc GhcRn Name name , foLabel :: XRec GhcRn RdrName GHC.foLabel = RdrName -> GenLocated (SrcAnn NameAnn) RdrName forall e ann. e -> GenLocated (SrcAnn ann) e genLoc (RdrName -> GenLocated (SrcAnn NameAnn) RdrName) -> RdrName -> GenLocated (SrcAnn NameAnn) RdrName forall a b. (a -> b) -> a -> b $ Name -> RdrName forall thing. NamedThing thing => thing -> RdrName getRdrName Name name } type LIdOccP a = GHC.LIdP a noUserRdr :: Name -> Name noUserRdr :: Name -> Name noUserRdr = Name -> Name forall a. a -> a id unLocWithUserRdr :: GenLocated l Name -> Name unLocWithUserRdr :: forall l. GenLocated l Name -> Name unLocWithUserRdr = GenLocated l Name -> Name forall l e. GenLocated l e -> e unLoc hsApp :: LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> HsExpr (GhcPass p) hsApp :: forall (p :: Pass). LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> HsExpr (GhcPass p) hsApp = XApp (GhcPass p) -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) -> HsExpr (GhcPass p) forall p. XApp p -> LHsExpr p -> LHsExpr p -> HsExpr p HsApp XApp (GhcPass p) EpAnn NoEpAnns forall a. EpAnn a noAnn genLoc :: e -> GenLocated (SrcAnn ann) e genLoc :: forall e ann. e -> GenLocated (SrcAnn ann) e genLoc = SrcAnn ann -> e -> GenLocated (SrcAnn ann) e forall l e. l -> e -> GenLocated l e L (EpAnn ann -> SrcSpan -> SrcAnn ann forall a. a -> SrcSpan -> SrcSpanAnn' a SrcSpanAnn EpAnn ann forall a. EpAnn a noAnn SrcSpan generatedSrcSpan) mkPrefixFunRhs :: LIdP GhcPs -> EpAnn () -> HsMatchContext GhcPs mkPrefixFunRhs :: LIdP GhcPs -> EpAnn () -> HsMatchContext GhcPs mkPrefixFunRhs LIdP GhcPs fn EpAnn () _ = LIdP (NoGhcTc GhcPs) -> HsMatchContext GhcPs forall p. LIdP (NoGhcTc p) -> HsMatchContext p GHC.mkPrefixFunRhs LIdP (NoGhcTc GhcPs) LIdP GhcPs fn toMatchArgs :: [LPat p] -> [LPat p] toMatchArgs :: forall p. [LPat p] -> [LPat p] toMatchArgs = [XRec p (Pat p)] -> [XRec p (Pat p)] forall a. a -> a id toGrhssGRHSs :: NonEmpty (LGRHS p body) -> [LGRHS p body] toGrhssGRHSs :: forall p body. NonEmpty (LGRHS p body) -> [LGRHS p body] toGrhssGRHSs = NonEmpty (XRec p (GRHS p body)) -> [XRec p (GRHS p body)] forall a. NonEmpty a -> [a] NonEmpty.toList mkPrefixCon :: [arg] -> HsConDetails tyargs arg rec mkPrefixCon :: forall arg tyargs rec. [arg] -> HsConDetails tyargs arg rec mkPrefixCon = [tyargs] -> [arg] -> HsConDetails tyargs arg rec forall tyarg arg rec. [tyarg] -> [arg] -> HsConDetails tyarg arg rec PrefixCon []