ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Gen.Expr

Synopsis

- tcCheckPolyExpr :: LHsExpr GhcRn -> TcSigmaType -> TcM (LHsExpr GhcTc)
- tcCheckPolyExprNC :: LHsExpr GhcRn -> TcSigmaType -> TcM (LHsExpr GhcTc)
- tcCheckMonoExpr :: LHsExpr GhcRn -> TcRhoType -> TcM (LHsExpr GhcTc)
- tcCheckMonoExprNC :: LHsExpr GhcRn -> TcRhoType -> TcM (LHsExpr GhcTc)
- tcMonoExpr :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc)
- tcMonoExprNC :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc)
- tcInferRho :: LHsExpr GhcRn -> TcM (LHsExpr GhcTc, TcRhoType)
- tcInferRhoNC :: LHsExpr GhcRn -> TcM (LHsExpr GhcTc, TcRhoType)
- tcPolyLExpr :: LHsExpr GhcRn -> ExpSigmaType -> TcM (LHsExpr GhcTc)
- tcPolyExpr :: HsExpr GhcRn -> ExpSigmaType -> TcM (HsExpr GhcTc)
- tcExpr :: HsExpr GhcRn -> ExpRhoType -> TcM (HsExpr GhcTc)
- tcPolyLExprSig :: LHsExpr GhcRn -> TcCompleteSig -> TcM (LHsExpr GhcTc)
- tcSyntaxOp :: CtOrigin -> SyntaxExprRn -> [SyntaxOpType] -> ExpRhoType -> ([TcSigmaType] -> [Mult] -> TcM a) -> TcM (a, SyntaxExprTc)
- tcSyntaxOpGen :: CtOrigin -> SyntaxExprRn -> [SyntaxOpType] -> SyntaxOpType -> ([TcSigmaTypeFRR] -> [Mult] -> TcM a) -> TcM (a, SyntaxExprTc)
- data SyntaxOpType
  - = SynAny
  - | SynRho
  - | SynList
  - | SynFun SyntaxOpType SyntaxOpType
  - | SynType ExpType
- synKnownType :: TcType -> SyntaxOpType
- tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr GhcTc)

# Documentation

tcCheckPolyExpr :: LHsExpr GhcRn -> TcSigmaType -> TcM (LHsExpr GhcTc) Source #

tcCheckPolyExprNC :: LHsExpr GhcRn -> TcSigmaType -> TcM (LHsExpr GhcTc) Source #

tcCheckMonoExpr :: LHsExpr GhcRn -> TcRhoType -> TcM (LHsExpr GhcTc) Source #

tcCheckMonoExprNC :: LHsExpr GhcRn -> TcRhoType -> TcM (LHsExpr GhcTc) Source #

tcMonoExpr :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc) Source #

tcMonoExprNC :: LHsExpr GhcRn -> ExpRhoType -> TcM (LHsExpr GhcTc) Source #

tcInferRho :: LHsExpr GhcRn -> TcM (LHsExpr GhcTc, TcRhoType) Source #

tcInferRhoNC :: LHsExpr GhcRn -> TcM (LHsExpr GhcTc, TcRhoType) Source #

tcPolyLExpr :: LHsExpr GhcRn -> ExpSigmaType -> TcM (LHsExpr GhcTc) Source #

tcPolyExpr :: HsExpr GhcRn -> ExpSigmaType -> TcM (HsExpr GhcTc) Source #

tcExpr :: HsExpr GhcRn -> ExpRhoType -> TcM (HsExpr GhcTc) Source #

tcPolyLExprSig :: LHsExpr GhcRn -> TcCompleteSig -> TcM (LHsExpr GhcTc) Source #

tcSyntaxOp Source #

Arguments

:: CtOrigin |
-> SyntaxExprRn |
-> [SyntaxOpType] | shape of syntax operator arguments
-> ExpRhoType | overall result type
-> ([TcSigmaType] -> [Mult] -> TcM a) | Type check any arguments, takes a type per hole and a multiplicity per arrow in the shape.
-> TcM (a, SyntaxExprTc) |

Typecheck a syntax operator The operator is a variable or a lambda at this stage (i.e. renamer output)t

tcSyntaxOpGen :: CtOrigin -> SyntaxExprRn -> [SyntaxOpType] -> SyntaxOpType -> ([TcSigmaTypeFRR] -> [Mult] -> TcM a) -> TcM (a, SyntaxExprTc) Source #

Slightly more general version of `tcSyntaxOp` that allows the caller to specify the shape of the result of the syntax operator

data SyntaxOpType Source #

What to expect for an argument to a rebindable-syntax operator. Quite like `Type`, but allows for holes to be filled in by tcSyntaxOp. The callback called from tcSyntaxOp gets a list of types; the meaning of these types is determined by a left-to-right depth-first traversal of the `SyntaxOpType` tree. So if you pass in

    SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny

you'll get three types back: one for the first `SynAny`, the element type of the list, and one for the last `SynAny`. You don't get anything for the `SynType`, because you've said positively that it should be an Int, and so it shall be.

You'll also get three multiplicities back: one for each function arrow. See also Note [Linear types] in Multiplicity.

This is defined here to avoid defining it in GHC.Tc.Gen.Expr boot file.

Constructors

SynAny | Any type
SynRho | A rho type, skolemised or instantiated as appropriate
SynList | A list type. You get back the element type of the list
SynFun SyntaxOpType SyntaxOpType infixr 0 | A function.
SynType ExpType | A known type.

synKnownType :: TcType -> SyntaxOpType Source #

Like `SynType` but accepts a regular TcType

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