Copyright | (c) The University of Glasgow 1992-2023 |
---|---|
Safe Haskell | None |
Language | GHC2021 |
Here we collect a variety of helper functions that construct or analyse HsSyn. All these functions deal with generic HsSyn; functions which deal with the instantiated versions are located elsewhere:
Parameterised by Module ---------------- ------------- GhcPs/RdrName GHC.Parser.PostProcess GhcRn/Name GHC.Rename.* GhcTc/Id GHC.Tc.Zonk.Type
The mk*
functions attempt to construct a not-completely-useless SrcSpan
from their components, compared with the nl*
functions which
just attach noSrcSpan to everything.
Synopsis
- mkHsPar :: forall (p :: Pass). IsPass p => LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
- mkHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
- mkHsAppWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
- mkHsApps :: forall (id :: Pass). LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
- mkHsAppsWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
- mkHsSyntaxApps :: SrcSpanAnnA -> SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
- mkHsAppType :: LHsExpr GhcRn -> LHsWcType GhcRn -> LHsExpr GhcRn
- mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn
- mkHsCaseAlt :: forall (p :: Pass) body. (Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns, Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA) => LPat (GhcPass p) -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
- mkSimpleMatch :: forall (p :: Pass) body. (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA, Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns) => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) -> LocatedE [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
- unguardedGRHSs :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
- unguardedRHS :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns => EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) -> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
- mkMatchGroup :: forall (p :: Pass) body. AnnoBody p body => Origin -> LocatedLW [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
- mkLamCaseMatchGroup :: forall (p :: Pass) body. AnnoBody p body => Origin -> HsLamVariant -> LocatedLW [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
- mkMatch :: forall (p :: Pass). IsPass p => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) -> LocatedE [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> HsLocalBinds (GhcPass p) -> LMatch (GhcPass p) (LHsExpr (GhcPass p))
- mkPrefixFunRhs :: fn -> AnnFunRhs -> HsMatchContext fn
- mkHsLam :: forall (p :: Pass). (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ Origin) => LocatedE [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
- mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> AnnsIf -> HsExpr GhcPs
- mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
- mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
- mkHsWrapCo :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
- mkHsWrapCoR :: TcCoercionR -> HsExpr GhcTc -> HsExpr GhcTc
- mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
- mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc
- mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc
- mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs
- mkHsDo :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> HsExpr GhcPs
- mkHsDoAnns :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> AnnList EpaLocation -> HsExpr GhcPs
- mkHsComp :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs
- mkHsCompAnns :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> AnnList EpaLocation -> HsExpr GhcPs
- mkHsWrapPat :: HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
- mkLHsWrapPat :: HsWrapper -> LPat GhcTc -> Type -> LPat GhcTc
- mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
- mkLHsPar :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
- mkHsCmdWrap :: HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc
- mkLHsCmdWrap :: HsWrapper -> LHsCmd GhcTc -> LHsCmd GhcTc
- mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> AnnsIf -> HsCmd GhcPs
- mkConLikeTc :: ConLike -> HsExpr GhcTc
- nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
- nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
- nlHsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsExpr (GhcPass p)
- nl_HsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> HsExpr (GhcPass p)
- nlHsDataCon :: DataCon -> LHsExpr GhcTc
- nlHsLit :: forall (p :: Pass). HsLit (GhcPass p) -> LHsExpr (GhcPass p)
- nlHsApp :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
- nlHsApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p)
- nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
- nlHsIntLit :: forall (p :: Pass). Integer -> LHsExpr (GhcPass p)
- nlHsVarApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p)
- nlHsDo :: HsDoFlavour -> [LStmt GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
- nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
- nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
- nlHsPar :: forall (p :: Pass). IsPass p => LHsExpr (GhcPass p) -> LHsExpr (GhcPass p)
- nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
- nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
- nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
- mkLHsTupleExpr :: forall (p :: Pass). [LHsExpr (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
- mkLHsVarTuple :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
- missingTupArg :: EpAnn Bool -> HsTupArg GhcPs
- mkLocatedList :: (Semigroup a, NoAnn an) => [GenLocated (EpAnn a) e2] -> LocatedAn an [GenLocated (EpAnn a) e2]
- nlAscribe :: RdrName -> LHsExpr GhcPs -> LHsExpr GhcPs
- mkFunBind :: Origin -> LocatedN RdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs
- mkVarBind :: IdP GhcTc -> LHsExpr GhcTc -> LHsBind GhcTc
- mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
- mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedE [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs
- mkTopFunBind :: Origin -> LocatedN Name -> [LMatch GhcRn (LHsExpr GhcRn)] -> HsBind GhcRn
- mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs -> LPat GhcPs -> HsPatSynDir GhcPs -> AnnPSB -> HsBind GhcPs
- isInfixFunBind :: forall id1 id2. UnXRec id2 => HsBindLR id1 id2 -> Bool
- spanHsLocaLBinds :: forall (p :: Pass). HsLocalBinds (GhcPass p) -> SrcSpan
- mkHsIntegral :: IntegralLit -> HsOverLit GhcPs
- mkHsFractional :: FractionalLit -> HsOverLit GhcPs
- mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs
- mkHsString :: forall (p :: Pass). String -> HsLit (GhcPass p)
- mkHsStringFS :: forall (p :: Pass). FastString -> HsLit (GhcPass p)
- mkHsStringPrimLit :: forall (p :: Pass). FastString -> HsLit (GhcPass p)
- mkHsCharPrimLit :: forall (p :: Pass). Char -> HsLit (GhcPass p)
- mkNPat :: LocatedAn NoEpAnns (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpToken "-" -> Pat GhcPs
- mkNPlusKPat :: LocatedN RdrName -> LocatedAn NoEpAnns (HsOverLit GhcPs) -> EpToken "+" -> Pat GhcPs
- nlVarPat :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LPat (GhcPass p)
- nlLitPat :: HsLit GhcPs -> LPat GhcPs
- nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
- nlConVarPatName :: Name -> [Name] -> LPat GhcRn
- nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
- nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
- nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs
- nlNullaryConPat :: RdrName -> LPat GhcPs
- nlWildConPat :: DataCon -> LPat GhcPs
- nlWildPat :: LPat GhcPs
- nlWildPatName :: LPat GhcRn
- nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
- mkParPat :: forall (p :: Pass). IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
- nlParPat :: forall (p :: Pass). IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
- mkBigLHsVarTup :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
- mkBigLHsTup :: forall (id :: Pass). [LHsExpr (GhcPass id)] -> XExplicitTuple (GhcPass id) -> LHsExpr (GhcPass id)
- mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn
- mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn
- mkHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
- mkHsAppKindTy :: forall (p :: Pass). XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
- hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs
- hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs
- mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs]
- mkHsSigEnv :: (LSig GhcRn -> Maybe ([LocatedN Name], a)) -> [LSig GhcRn] -> NameEnv a
- nlHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
- nlHsAppKindTy :: forall (p :: Pass). IsPass p => LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p)
- nlHsTyVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p)
- nlHsFunTy :: forall (p :: Pass). IsPass p => LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
- nlHsParTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
- nlHsTyConApp :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> LexicalFixity -> IdP (GhcPass p) -> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p)
- mkTransformStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
- mkTransformByStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
- mkBodyStmt :: forall bodyR (idL :: Pass). LocatedA (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs))
- mkPsBindStmt :: EpUniToken "<-" "\8592" -> LPat GhcPs -> LocatedA (bodyR GhcPs) -> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
- mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn) -> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn))
- mkTcBindStmt :: LPat GhcTc -> LocatedA (bodyR GhcTc) -> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
- mkLastStmt :: forall (idR :: Pass) bodyR (idL :: Pass). IsPass idR => LocatedA (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
- emptyTransStmt :: AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
- mkGroupUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
- mkGroupByUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
- emptyRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnLW => StmtLR (GhcPass idL) GhcPs bodyR
- emptyRecStmtName :: Anno [GenLocated (Anno (StmtLR GhcRn GhcRn bodyR)) (StmtLR GhcRn GhcRn bodyR)] ~ SrcSpanAnnLW => StmtLR GhcRn GhcRn bodyR
- emptyRecStmtId :: Stmt GhcTc (LocatedA (HsCmd GhcTc))
- mkRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnLW => AnnList (EpToken "rec") -> LocatedLW [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR
- unitRecStmtTc :: RecStmtTc
- mkLetStmt :: EpToken "let" -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
- isUnliftedHsBind :: HsBind GhcTc -> Bool
- isUnliftedHsBinds :: LHsBinds GhcTc -> Bool
- isBangedHsBind :: HsBind GhcTc -> Bool
- collectLocalBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
- collectHsValBinders :: forall (idL :: Pass) idR. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) idR -> [IdP (GhcPass idL)]
- collectHsBindListBinders :: CollectPass p => CollectFlag p -> [LHsBindLR p idR] -> [IdP p]
- collectHsIdBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)]
- collectHsBindsBinders :: CollectPass p => CollectFlag p -> LHsBindsLR p idR -> [IdP p]
- collectHsBindBinders :: CollectPass p => CollectFlag p -> HsBindLR p idR -> [IdP p]
- collectMethodBinders :: UnXRec idL => LHsBindsLR idL idR -> [LIdP idL]
- collectPatBinders :: CollectPass p => CollectFlag p -> LPat p -> [IdP p]
- collectPatsBinders :: CollectPass p => CollectFlag p -> [LPat p] -> [IdP p]
- collectLStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
- collectStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)]
- collectLStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
- collectStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)]
- class UnXRec p => CollectPass p where
- collectXXPat :: CollectFlag p -> XXPat p -> [IdP p] -> [IdP p]
- collectXXHsBindsLR :: XXHsBindsLR p pR -> [IdP p] -> [IdP p]
- collectXSplicePat :: CollectFlag p -> XSplicePat p -> [IdP p] -> [IdP p]
- data CollectFlag p where
- CollNoDictBinders :: forall p. CollectFlag p
- CollWithDictBinders :: CollectFlag (GhcPass 'Typechecked)
- CollVarTyVarBinders :: CollectFlag (GhcPass 'Renamed)
- data TyDeclBinders (p :: Pass) = TyDeclBinders {
- tyDeclMainBinder :: !(LocatedA (IdP (GhcPass p)), TyConFlavour ())
- tyDeclATs :: ![(LocatedA (IdP (GhcPass p)), TyConFlavour ())]
- tyDeclOpSigs :: ![LocatedA (IdP (GhcPass p))]
- tyDeclConsWithFields :: !(LConsWithFields p)
- data LConsWithFields (p :: Pass) = LConsWithFields {}
- hsLTyClDeclBinders :: forall (p :: Pass). (IsPass p, OutputableBndrId p) => LocatedA (TyClDecl (GhcPass p)) -> TyDeclBinders p
- hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name]
- hsPatSynSelectors :: forall (p :: Pass). IsPass p => HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)]
- getPatSynBinds :: UnXRec id => [(RecFlag, LHsBinds id)] -> [PatSynBind id id]
- hsForeignDeclsBinders :: forall (p :: Pass) a. (UnXRec (GhcPass p), IsSrcSpanAnn p a) => [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
- hsGroupBinders :: HsGroup GhcRn -> [Name]
- hsDataFamInstBinders :: forall (p :: Pass). (IsPass p, OutputableBndrId p) => DataFamInstDecl (GhcPass p) -> LConsWithFields p
- data ImplicitFieldBinders = ImplicitFieldBinders {}
- lStmtsImplicits :: forall (idR :: Pass) (body :: Type -> Type). IsPass idR => [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))] -> [(SrcSpan, [ImplicitFieldBinders])]
- hsValBindsImplicits :: forall (idR :: Pass). HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [ImplicitFieldBinders])]
- lPatImplicits :: LPat GhcRn -> [(SrcSpan, [ImplicitFieldBinders])]
- lHsRecFieldsImplicits :: [LHsRecField GhcRn (LPat GhcRn)] -> RecFieldsDotDot -> [ImplicitFieldBinders]
Terms
mkHsPar :: forall (p :: Pass). IsPass p => LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) Source #
e => (e)
mkHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) Source #
mkHsAppWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) Source #
mkHsApps :: forall (id :: Pass). LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) Source #
mkHsAppsWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) Source #
mkHsSyntaxApps :: SrcSpanAnnA -> SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc Source #
mkHsCaseAlt :: forall (p :: Pass) body. (Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns, Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA) => LPat (GhcPass p) -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p))) Source #
A simple case alternative with a single pattern, no binds, no guards; pre-typechecking
mkSimpleMatch :: forall (p :: Pass) body. (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA, Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns) => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) -> LocatedE [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p))) Source #
unguardedGRHSs :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p))) Source #
unguardedRHS :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns => EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) -> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))] Source #
mkMatchGroup :: forall (p :: Pass) body. AnnoBody p body => Origin -> LocatedLW [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p))) Source #
mkLamCaseMatchGroup :: forall (p :: Pass) body. AnnoBody p body => Origin -> HsLamVariant -> LocatedLW [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p))) Source #
mkMatch :: forall (p :: Pass). IsPass p => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) -> LocatedE [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> HsLocalBinds (GhcPass p) -> LMatch (GhcPass p) (LHsExpr (GhcPass p)) Source #
mkPrefixFunRhs :: fn -> AnnFunRhs -> HsMatchContext fn Source #
Make a prefix, non-strict function HsMatchContext
mkHsLam :: forall (p :: Pass). (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ Origin) => LocatedE [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) Source #
mkHsWrapCo :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc Source #
mkHsWrapCoR :: TcCoercionR -> HsExpr GhcTc -> HsExpr GhcTc Source #
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc Source #
mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs Source #
A useful function for building OpApps
. The operator is always a
variable, and we don't know the fixity yet.
mkHsDoAnns :: HsDoFlavour -> LocatedLW [ExprLStmt GhcPs] -> AnnList EpaLocation -> HsExpr GhcPs Source #
mkHsCompAnns :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> AnnList EpaLocation -> HsExpr GhcPs Source #
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc Source #
mkLHsPar :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) Source #
Wrap in parens if
says it needs them
So hsExprNeedsParens
appPrecf x
becomes (f x)
, but 3
stays as 3
.
nlHsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsExpr (GhcPass p) Source #
nl_HsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> HsExpr (GhcPass p) Source #
nlHsApp :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) Source #
nlHsApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p) Source #
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc Source #
nlHsVarApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p) Source #
mkLHsTupleExpr :: forall (p :: Pass). [LHsExpr (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p) Source #
mkLHsVarTuple :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p) Source #
mkLocatedList :: (Semigroup a, NoAnn an) => [GenLocated (EpAnn a) e2] -> LocatedAn an [GenLocated (EpAnn a) e2] Source #
Bindings
mkFunBind :: Origin -> LocatedN RdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs Source #
Not infix, with place holders for coercion and free vars
mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedE [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs Source #
Convenience function using mkFunBind
.
This is for generated bindings only, do not use for user-written code.
mkTopFunBind :: Origin -> LocatedN Name -> [LMatch GhcRn (LHsExpr GhcRn)] -> HsBind GhcRn Source #
In Name-land, with empty bind_fvs
mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs -> LPat GhcPs -> HsPatSynDir GhcPs -> AnnPSB -> HsBind GhcPs Source #
spanHsLocaLBinds :: forall (p :: Pass). HsLocalBinds (GhcPass p) -> SrcSpan Source #
Return the SrcSpan
encompassing the contents of any enclosed binds
Literals
mkHsIntegral :: IntegralLit -> HsOverLit GhcPs Source #
mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs Source #
mkHsStringFS :: forall (p :: Pass). FastString -> HsLit (GhcPass p) Source #
mkHsStringPrimLit :: forall (p :: Pass). FastString -> HsLit (GhcPass p) Source #
Patterns
mkNPat :: LocatedAn NoEpAnns (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpToken "-" -> Pat GhcPs Source #
mkNPlusKPat :: LocatedN RdrName -> LocatedAn NoEpAnns (HsOverLit GhcPs) -> EpToken "+" -> Pat GhcPs Source #
nlWildPatName :: LPat GhcRn Source #
Wildcard pattern - after renaming
mkBigLHsVarTup :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p) Source #
The Big equivalents for the source tuple expressions
mkBigLHsTup :: forall (id :: Pass). [LHsExpr (GhcPass id)] -> XExplicitTuple (GhcPass id) -> LHsExpr (GhcPass id) Source #
mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn Source #
The Big equivalents for the source tuple patterns
Types
mkHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) Source #
mkHsAppKindTy :: forall (p :: Pass). XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) Source #
hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs Source #
Convert an LHsType
to an LHsSigType
.
hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs Source #
Convert an LHsType
to an LHsSigWcType
.
mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs] Source #
Convert TypeSig
to ClassOpSig
.
The former is what is parsed, but the latter is
what we need in class/instance declarations
nlHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) Source #
nlHsAppKindTy :: forall (p :: Pass). IsPass p => LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p) Source #
nlHsTyVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> IdP (GhcPass p) -> LHsType (GhcPass p) Source #
nlHsFunTy :: forall (p :: Pass). IsPass p => LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) Source #
nlHsTyConApp :: forall (p :: Pass) a. IsSrcSpanAnn p a => PromotionFlag -> LexicalFixity -> IdP (GhcPass p) -> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p) Source #
Stmts
mkTransformStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) Source #
mkTransformByStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) Source #
mkBodyStmt :: forall bodyR (idL :: Pass). LocatedA (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs)) Source #
mkPsBindStmt :: EpUniToken "<-" "\8592" -> LPat GhcPs -> LocatedA (bodyR GhcPs) -> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs)) Source #
mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn) -> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn)) Source #
mkTcBindStmt :: LPat GhcTc -> LocatedA (bodyR GhcTc) -> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc)) Source #
mkLastStmt :: forall (idR :: Pass) bodyR (idL :: Pass). IsPass idR => LocatedA (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR))) Source #
emptyTransStmt :: AnnTransStmt -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) Source #
mkGroupUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) Source #
mkGroupByUsingStmt :: AnnTransStmt -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) Source #
emptyRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnLW => StmtLR (GhcPass idL) GhcPs bodyR Source #
emptyRecStmtName :: Anno [GenLocated (Anno (StmtLR GhcRn GhcRn bodyR)) (StmtLR GhcRn GhcRn bodyR)] ~ SrcSpanAnnLW => StmtLR GhcRn GhcRn bodyR Source #
mkRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnLW => AnnList (EpToken "rec") -> LocatedLW [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR Source #
Collecting binders
isUnliftedHsBind :: HsBind GhcTc -> Bool Source #
Should we treat this as an unlifted bind? This will be true for any bind that binds an unlifted variable, but we must be careful around AbsBinds. See Note [isUnliftedHsBind]. For usage information, see Note [Strict binds checks] is GHC.HsToCore.Binds.
isBangedHsBind :: HsBind GhcTc -> Bool Source #
Is a binding a strict variable or pattern bind (e.g. !x = ...
)?
collectLocalBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] Source #
collectHsValBinders :: forall (idL :: Pass) idR. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) idR -> [IdP (GhcPass idL)] Source #
collectHsBindListBinders :: CollectPass p => CollectFlag p -> [LHsBindLR p idR] -> [IdP p] Source #
Same as collectHsBindsBinders
, but works over a list of bindings
collectHsIdBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] Source #
collectHsBindsBinders :: CollectPass p => CollectFlag p -> LHsBindsLR p idR -> [IdP p] Source #
collectHsBindBinders :: CollectPass p => CollectFlag p -> HsBindLR p idR -> [IdP p] Source #
Collect both Id
s and pattern-synonym binders
collectMethodBinders :: UnXRec idL => LHsBindsLR idL idR -> [LIdP idL] Source #
Used exclusively for the bindings of an instance decl which are all
FunBinds
collectPatBinders :: CollectPass p => CollectFlag p -> LPat p -> [IdP p] Source #
collectPatsBinders :: CollectPass p => CollectFlag p -> [LPat p] -> [IdP p] Source #
collectLStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] Source #
collectStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] Source #
collectLStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] Source #
collectStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. (IsPass idL, IsPass idR, CollectPass (GhcPass idL)) => CollectFlag (GhcPass idL) -> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] Source #
class UnXRec p => CollectPass p where Source #
This class specifies how to collect variable identifiers from extension patterns in the given pass. Consumers of the GHC API that define their own passes should feel free to implement instances in order to make use of functions which depend on it.
In particular, Haddock already makes use of this, with an instance for its DocNameI
pass so that
it can reuse the code in GHC for collecting binders.
collectXXPat :: CollectFlag p -> XXPat p -> [IdP p] -> [IdP p] Source #
collectXXHsBindsLR :: XXHsBindsLR p pR -> [IdP p] -> [IdP p] Source #
collectXSplicePat :: CollectFlag p -> XSplicePat p -> [IdP p] -> [IdP p] Source #
Instances
IsPass p => CollectPass (GhcPass p) Source # | |
Defined in GHC.Hs.Utils collectXXPat :: CollectFlag (GhcPass p) -> XXPat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)] Source # collectXXHsBindsLR :: XXHsBindsLR (GhcPass p) pR -> [IdP (GhcPass p)] -> [IdP (GhcPass p)] Source # collectXSplicePat :: CollectFlag (GhcPass p) -> XSplicePat (GhcPass p) -> [IdP (GhcPass p)] -> [IdP (GhcPass p)] Source # |
data CollectFlag p where Source #
Indicate if evidence binders and type variable binders have to be collected.
This type enumerates the modes of collecting bound variables | evidence | type | term | ghc | | binders | variables | variables | pass | -------------------------------------------- CollNoDictBinders | no | no | yes | any | CollWithDictBinders | yes | no | yes | GhcTc | CollVarTyVarBinders | no | yes | yes | GhcRn |
See Note [Dictionary binders in ConPatOut]
CollNoDictBinders :: forall p. CollectFlag p | Don't collect evidence binders |
CollWithDictBinders :: CollectFlag (GhcPass 'Typechecked) | Collect evidence binders |
CollVarTyVarBinders :: CollectFlag (GhcPass 'Renamed) | Collect variable and type variable binders, but no evidence binders |
data TyDeclBinders (p :: Pass) Source #
TyDeclBinders | |
|
data LConsWithFields (p :: Pass) Source #
A mapping from constructors to all of their fields.
See Note [Collecting record fields in data declarations].
hsLTyClDeclBinders :: forall (p :: Pass). (IsPass p, OutputableBndrId p) => LocatedA (TyClDecl (GhcPass p)) -> TyDeclBinders p Source #
Returns all the binding names of the decl. The first one is guaranteed to be the name of the decl. The first component represents all binding names except record fields; the second represents field occurrences. For record fields mentioned in multiple constructors, the SrcLoc will be from the first occurrence.
Each returned (Located name) has a SrcSpan for the whole declaration. See Note [SrcSpan for binders]
hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name] Source #
hsPatSynSelectors :: forall (p :: Pass). IsPass p => HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)] Source #
Collects record pattern-synonym selectors only; the pattern synonym
names are collected by collectHsValBinders
.
getPatSynBinds :: UnXRec id => [(RecFlag, LHsBinds id)] -> [PatSynBind id id] Source #
hsForeignDeclsBinders :: forall (p :: Pass) a. (UnXRec (GhcPass p), IsSrcSpanAnn p a) => [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)] Source #
See Note [SrcSpan for binders]
hsDataFamInstBinders :: forall (p :: Pass). (IsPass p, OutputableBndrId p) => DataFamInstDecl (GhcPass p) -> LConsWithFields p Source #
the SrcLoc
returned are for the whole declarations, not just the names
Collecting implicit binders
data ImplicitFieldBinders Source #
All binders corresponding to a single implicit record field pattern.
See Note [Collecting implicit binders].
ImplicitFieldBinders | |
|
lStmtsImplicits :: forall (idR :: Pass) (body :: Type -> Type). IsPass idR => [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))] -> [(SrcSpan, [ImplicitFieldBinders])] Source #
hsValBindsImplicits :: forall (idR :: Pass). HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [ImplicitFieldBinders])] Source #
lPatImplicits :: LPat GhcRn -> [(SrcSpan, [ImplicitFieldBinders])] Source #
Collect all record wild card binders in the given pattern.
These are all the variables bound in all (possibly nested) record wildcard patterns appearing inside the pattern.
See Note [Collecting implicit binders].
lHsRecFieldsImplicits :: [LHsRecField GhcRn (LPat GhcRn)] -> RecFieldsDotDot -> [ImplicitFieldBinders] Source #