ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

TcExpr

Synopsis

- tcPolyExpr :: LHsExpr Name -> TcSigmaType -> TcM (LHsExpr TcId)
- tcMonoExpr :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId)
- tcMonoExprNC :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId)
- tcInferSigma :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType)
- tcInferSigmaNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType)
- tcInferRho :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
- tcInferRhoNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType)
- tcSyntaxOp :: CtOrigin -> SyntaxExpr Name -> [SyntaxOpType] -> ExpRhoType -> ([TcSigmaType] -> TcM a) -> TcM (a, SyntaxExpr TcId)
- tcSyntaxOpGen :: CtOrigin -> SyntaxExpr Name -> [SyntaxOpType] -> SyntaxOpType -> ([TcSigmaType] -> TcM a) -> TcM (a, SyntaxExpr TcId)
- data SyntaxOpType
  - = SynAny
  - | SynRho
  - | SynList
  - | SynFun SyntaxOpType SyntaxOpType
  - | SynType ExpType
- synKnownType :: TcType -> SyntaxOpType
- tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr TcId)
- addExprErrCtxt :: LHsExpr Name -> TcM a -> TcM a
- getFixedTyVars :: [FieldLabelString] -> [TyVar] -> [ConLike] -> TyVarSet

# Documentation

tcPolyExpr :: LHsExpr Name -> TcSigmaType -> TcM (LHsExpr TcId) #

tcMonoExpr :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId) #

tcMonoExprNC :: LHsExpr Name -> ExpRhoType -> TcM (LHsExpr TcId) #

tcInferSigma :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType) #

tcInferSigmaNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcSigmaType) #

tcInferRho :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType) #

tcInferRhoNC :: LHsExpr Name -> TcM (LHsExpr TcId, TcRhoType) #

tcSyntaxOp #

Arguments

:: CtOrigin |
-> SyntaxExpr Name |
-> [SyntaxOpType] | shape of syntax operator arguments
-> ExpRhoType | overall result type
-> ([TcSigmaType] -> TcM a) | Type check any arguments
-> TcM (a, SyntaxExpr TcId) |

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

tcSyntaxOpGen :: CtOrigin -> SyntaxExpr Name -> [SyntaxOpType] -> SyntaxOpType -> ([TcSigmaType] -> TcM a) -> TcM (a, SyntaxExpr TcId) #

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

data SyntaxOpType #

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.

This is defined here to avoid defining it in TcExpr.hs-boot.

Constructors

SynAny | Any type
SynRho | A rho type, deeply 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 #

Like `SynType` but accepts a regular TcType

tcCheckId :: Name -> ExpRhoType -> TcM (HsExpr TcId) #

addExprErrCtxt :: LHsExpr Name -> TcM a -> TcM a #

getFixedTyVars :: [FieldLabelString] -> [TyVar] -> [ConLike] -> TyVarSet #