GHC.Tc.Gen.Head

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Gen.Head

Synopsis

- data HsExprArg (p :: TcPass) where
  - EValArg :: forall (p :: TcPass). {..} -> HsExprArg p
  - EValArgQL :: {..} -> HsExprArg 'TcpInst
  - ETypeArg :: forall (p :: TcPass). {..} -> HsExprArg p
  - EPrag :: forall (p :: TcPass). AppCtxt -> HsPragE (GhcPass (XPass p)) -> HsExprArg p
  - EWrap :: forall (p :: TcPass). EWrap -> HsExprArg p
- data TcPass
  - = TcpRn
  - | TcpInst
  - | TcpTc
- data QLFlag
  - = DoQL
  - | NoQL
- data EWrap
  - = EPar AppCtxt
  - | EExpand HsThingRn
  - | EHsWrap HsWrapper
- 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] -> HsExpr GhcTc
- addArgWrap :: forall (p :: TcPass). HsWrapper -> [HsExprArg p] -> [HsExprArg p]
- isHsValArg :: forall (id :: TcPass). HsExprArg id -> Bool
- leadingValArgs :: [HsExprArg 'TcpRn] -> [LHsExpr GhcRn]
- isVisibleArg :: forall (id :: TcPass). HsExprArg id -> Bool
- tcInferAppHead :: (HsExpr GhcRn, AppCtxt) -> TcM (HsExpr GhcTc, TcSigmaType)
- tcInferAppHead_maybe :: HsExpr GhcRn -> TcM (Maybe (HsExpr GhcTc, TcSigmaType))
- tcInferId :: LocatedN (WithUserRdr Name) -> TcM (HsExpr GhcTc, TcSigmaType)
- tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr GhcTc)
- tcInferConLike :: ConLike -> TcM (HsExpr GhcTc, TcSigmaType)
- obviousSig :: HsExpr GhcRn -> Maybe (LHsSigWcType GhcRn)
- tyConOf :: FamInstEnvs -> TcSigmaType -> Maybe TyCon
- tyConOfET :: FamInstEnvs -> ExpRhoType -> Maybe TyCon
- nonBidirectionalErr :: Name -> TcRnMessage
- pprArgInst :: HsExprArg 'TcpInst -> SDoc
- addHeadCtxt :: AppCtxt -> TcM a -> TcM a
- addExprCtxt :: HsExpr GhcRn -> TcRn a -> TcRn a
- addStmtCtxt :: ExprStmt GhcRn -> TcRn a -> TcRn a
- addFunResCtxt :: forall (p :: TcPass) a. HsExpr GhcTc -> [HsExprArg p] -> TcType -> ExpRhoType -> TcM a -> TcM a

# Documentation

data HsExprArg (p :: TcPass) where Source #

Constructors

EValArg |
Fields :: forall (p :: TcPass). { ea_ctxt :: AppCtxt , ea_arg_ty :: !(XEVAType p) , ea_arg :: LHsExpr (GhcPass (XPass p)) } -> HsExprArg p
EValArgQL |
Fields :: { eaql_ctxt :: AppCtxt , eaql_arg_ty :: Scaled TcSigmaType , eaql_larg :: LHsExpr GhcRn , eaql_tc_fun :: (HsExpr GhcTc, AppCtxt) , eaql_fun_ue :: UsageEnv , eaql_args :: [HsExprArg 'TcpInst] , eaql_wanted :: WantedConstraints , eaql_encl :: Bool , eaql_res_rho :: TcRhoType } -> HsExprArg 'TcpInst
ETypeArg |
Fields :: forall (p :: TcPass). { ea_ctxt :: AppCtxt , ea_hs_ty :: LHsWcType GhcRn , ea_ty_arg :: !(XETAType p) } -> HsExprArg p
EPrag :: forall (p :: TcPass). AppCtxt -> HsPragE (GhcPass (XPass p)) -> HsExprArg p |
EWrap :: forall (p :: TcPass). EWrap -> HsExprArg p |

#### 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 TcPass Source #

Constructors

TcpRn |
TcpInst |
TcpTc |

data QLFlag Source #

Constructors

DoQL |
NoQL |

#### Instances

Instances details

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

data EWrap Source #

Constructors

EPar AppCtxt |
EExpand HsThingRn |
EHsWrap HsWrapper |

#### Instances

Instances details

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

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, AppCtxt) | the function being applied
-> [HsExprArg 'TcpTc] | the arguments to the function
-> 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 :: [HsExprArg 'TcpRn] -> [LHsExpr GhcRn] Source #

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

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

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

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

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

tcInferConLike :: ConLike -> TcM (HsExpr GhcTc, TcSigmaType) Source #

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

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

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

nonBidirectionalErr :: Name -> TcRnMessage Source #

pprArgInst :: HsExprArg 'TcpInst -> SDoc 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 :: forall (p :: TcPass) a. HsExpr GhcTc -> [HsExprArg p] -> TcType -> ExpRhoType -> TcM a -> TcM a Source #