GHC.Tc.Gen.Head

ghc-9.10.0.20240426: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Gen.Head

Synopsis

- data HsExprArg (p :: TcPass)
  - = EValArg {
    - eva_ctxt :: AppCtxt
    - eva_arg :: EValArg p
    - eva_arg_ty :: !(XEVAType p)
    }
  - | ETypeArg {
    - eva_ctxt :: AppCtxt
    - eva_hs_ty :: LHsWcType GhcRn
    - eva_ty :: !(XETAType p)
    }
  - | EPrag AppCtxt (HsPragE (GhcPass (XPass p)))
  - | EWrap EWrap
- data EValArg (p :: TcPass) where
  - ValArg :: forall (p :: TcPass). LHsExpr (GhcPass (XPass p)) -> EValArg p
  - ValArgQL :: {..} -> EValArg 'TcpInst
- data TcPass
  - = TcpRn
  - | TcpInst
  - | TcpTc
- data AppCtxt
  - = VAExpansion HsThingRn SrcSpan SrcSpan
  - | VACall (HsExpr GhcRn) Int SrcSpan
- appCtxtLoc :: AppCtxt -> SrcSpan
- insideExpansion :: AppCtxt -> Bool
- splitHsApps :: HsExpr GhcRn -> TcM ((HsExpr GhcRn, AppCtxt), [HsExprArg 'TcpRn])
- rebuildHsApps :: HsExpr GhcTc -> AppCtxt -> [HsExprArg 'TcpTc] -> TcRhoType -> TcM (HsExpr GhcTc)
- addArgWrap :: forall (p :: TcPass). HsWrapper -> [HsExprArg p] -> [HsExprArg p]
- isHsValArg :: forall (id :: TcPass). HsExprArg id -> Bool
- leadingValArgs :: forall (id :: TcPass). [HsExprArg id] -> [EValArg id]
- isVisibleArg :: forall (id :: TcPass). HsExprArg id -> Bool
- pprHsExprArgTc :: HsExprArg 'TcpInst -> SDoc
- tcInferAppHead :: (HsExpr GhcRn, AppCtxt) -> TcM (HsExpr GhcTc, TcSigmaType)
- tcInferAppHead_maybe :: HsExpr GhcRn -> TcM (Maybe (HsExpr GhcTc, TcSigmaType))
- tcInferId :: Name -> TcM (HsExpr GhcTc, TcSigmaType)
- tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr GhcTc)
- obviousSig :: HsExpr GhcRn -> Maybe (LHsSigWcType GhcRn)
- tyConOf :: FamInstEnvs -> TcSigmaType -> Maybe TyCon
- tyConOfET :: FamInstEnvs -> ExpRhoType -> Maybe TyCon
- fieldNotInType :: RecSelParent -> RdrName -> TcRnMessage
- nonBidirectionalErr :: Name -> TcRnMessage
- addHeadCtxt :: AppCtxt -> TcM a -> TcM a
- addExprCtxt :: HsExpr GhcRn -> TcRn a -> TcRn a
- addStmtCtxt :: ExprStmt GhcRn -> TcRn a -> TcRn a
- addFunResCtxt :: HsExpr GhcRn -> [HsExprArg 'TcpRn] -> TcType -> ExpRhoType -> TcM a -> TcM a

# Documentation

data HsExprArg (p :: TcPass) Source #

Constructors

EValArg |
Fields eva_ctxt :: AppCtxt eva_arg :: EValArg p eva_arg_ty :: !(XEVAType p)
ETypeArg |
Fields eva_ctxt :: AppCtxt eva_hs_ty :: LHsWcType GhcRn eva_ty :: !(XETAType p)
EPrag AppCtxt (HsPragE (GhcPass (XPass p))) |
EWrap EWrap |

#### Instances

Instances details

OutputableBndrId (XPass p) => Outputable (HsExprArg p) Source # |
Instance details Defined in GHC.Tc.Gen.Head Methods ppr :: HsExprArg p -> SDoc Source #

data EValArg (p :: TcPass) where Source #

Constructors

ValArg :: forall (p :: TcPass). LHsExpr (GhcPass (XPass p)) -> EValArg p |
ValArgQL |
Fields :: { va_expr :: LHsExpr GhcRn , va_fun :: (HsExpr GhcTc, AppCtxt) , va_args :: [HsExprArg 'TcpInst] , va_ty :: TcRhoType } -> EValArg 'TcpInst

#### Instances

Instances details

OutputableBndrId (XPass p) => Outputable (EValArg p) Source # |
Instance details Defined in GHC.Tc.Gen.Head Methods ppr :: EValArg p -> SDoc Source #

data TcPass Source #

Constructors

TcpRn |
TcpInst |
TcpTc |

data AppCtxt Source #

Constructors

VAExpansion HsThingRn SrcSpan SrcSpan |
VACall (HsExpr GhcRn) Int SrcSpan |

#### Instances

Instances details

Outputable AppCtxt Source # |
Instance details Defined in GHC.Tc.Gen.Head Methods ppr :: AppCtxt -> SDoc Source #

appCtxtLoc :: AppCtxt -> SrcSpan Source #

insideExpansion :: AppCtxt -> Bool Source #

splitHsApps :: HsExpr GhcRn -> TcM ((HsExpr GhcRn, AppCtxt), [HsExprArg 'TcpRn]) Source #

rebuildHsApps Source #

Arguments

:: HsExpr GhcTc | the function being applied
-> AppCtxt |
-> [HsExprArg 'TcpTc] | the arguments to the function
-> TcRhoType | result type of the application
-> TcM (HsExpr GhcTc) |

Rebuild an application: takes a type-checked application head expression together with arguments in the form of typechecked `HsExprArg`s and returns a typechecked application of the head to the arguments.

This performs a representation-polymorphism check to ensure that representation-polymorphic unlifted newtypes have been eta-expanded.

See Note [Eta-expanding rep-poly unlifted newtypes].

addArgWrap :: forall (p :: TcPass). HsWrapper -> [HsExprArg p] -> [HsExprArg p] Source #

isHsValArg :: forall (id :: TcPass). HsExprArg id -> Bool Source #

leadingValArgs :: forall (id :: TcPass). [HsExprArg id] -> [EValArg id] Source #

isVisibleArg :: forall (id :: TcPass). HsExprArg id -> Bool Source #

pprHsExprArgTc :: HsExprArg 'TcpInst -> SDoc Source #

tcInferAppHead :: (HsExpr GhcRn, AppCtxt) -> TcM (HsExpr GhcTc, TcSigmaType) Source #

tcInferAppHead_maybe :: HsExpr GhcRn -> TcM (Maybe (HsExpr GhcTc, TcSigmaType)) Source #

tcInferId :: Name -> TcM (HsExpr GhcTc, TcSigmaType) Source #

tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr GhcTc) Source #

obviousSig :: HsExpr GhcRn -> Maybe (LHsSigWcType GhcRn) Source #

tyConOf :: FamInstEnvs -> TcSigmaType -> Maybe TyCon Source #

tyConOfET :: FamInstEnvs -> ExpRhoType -> Maybe TyCon Source #

fieldNotInType :: RecSelParent -> RdrName -> TcRnMessage Source #

nonBidirectionalErr :: Name -> TcRnMessage Source #

addHeadCtxt :: AppCtxt -> TcM a -> TcM a Source #

addExprCtxt :: HsExpr GhcRn -> TcRn a -> TcRn a Source #

addStmtCtxt :: ExprStmt GhcRn -> TcRn a -> TcRn a Source #

addFunResCtxt :: HsExpr GhcRn -> [HsExprArg 'TcpRn] -> TcType -> ExpRhoType -> TcM a -> TcM a Source #