ghc-8.0.0.20160111: The GHC API

Safe HaskellNone
LanguageHaskell2010

TcUnify

Synopsis

Documentation

tcWrapResultO :: CtOrigin -> HsExpr TcId -> TcSigmaType -> TcRhoType -> TcM (HsExpr TcId)

Sometimes we don't have a HsExpr Name to hand, and this is more convenient.

tcSkolemise

Arguments

:: UserTypeCtxt 
-> TcSigmaType 
-> ([TcTyVar] -> TcType -> TcM result)

thing_inside is passed only the *type* variables, not *coercion* variables. They are only ever used for scoped type variables.

-> TcM (HsWrapper, result)

The expression has type: spec_ty -> expected_ty

Take an "expected type" and strip off quantifiers to expose the type underneath, binding the new skolems for the thing_inside. The returned HsWrapper has type specific_ty -> expected_ty.

tcSubTypeHR

Arguments

:: Outputable a 
=> CtOrigin

of the actual type

-> Maybe a

If present, it has type ty_actual

-> TcSigmaType 
-> TcRhoType 
-> TcM HsWrapper 

Call this variant when you are in a higher-rank situation and you know the right-hand type is deeply skolemised.

tcSubType

Arguments

:: Outputable a 
=> UserTypeCtxt 
-> Maybe a

If present, it has type ty_actual

-> TcSigmaType 
-> TcSigmaType 
-> TcM HsWrapper 

tcSubTypeDS

Arguments

:: Outputable a 
=> UserTypeCtxt 
-> Maybe a

has type ty_actual

-> TcSigmaType 
-> TcRhoType 
-> TcM HsWrapper 

tcSubTypeDS_O :: Outputable a => CtOrigin -> UserTypeCtxt -> Maybe a -> TcSigmaType -> TcRhoType -> TcM HsWrapper

Like tcSubTypeDS, but takes a CtOrigin to use when instantiating the "actual" type

tcSubTypeDS_NC

Arguments

:: Outputable a 
=> UserTypeCtxt 
-> Maybe a

If present, this has type ty_actual

-> TcSigmaType 
-> TcRhoType 
-> TcM HsWrapper 

checkConstraints :: SkolemInfo -> [TcTyVar] -> [EvVar] -> TcM result -> TcM (TcEvBinds, result)

buildImplication :: SkolemInfo -> [TcTyVar] -> [EvVar] -> TcM result -> TcM (Bag Implication, TcEvBinds, result)

unifyType_

Arguments

:: Outputable a 
=> Maybe a

If present, has type ty1

-> TcTauType 
-> TcTauType 
-> TcM () 

Unify two types, discarding a resultant coercion. Any constraints generated will still need to be solved, however.

unifyType

Arguments

:: Outputable a 
=> Maybe a

If present, has type ty1

-> TcTauType 
-> TcTauType 
-> TcM TcCoercion 

noThing :: Maybe (HsExpr Name)

Use this instead of Nothing when calling unifyType without a good "thing" (where the "thing" has the "actual" type passed in) This has an Outputable instance, avoiding amgiguity problems.

tcInfer :: (TcType -> TcM a) -> TcM (a, TcType)

Infer a type using a type "checking" function by passing in a ReturnTv, which can unify with *anything*. See also Note [ReturnTv] in TcType

matchActualFunTysPart :: SDoc -> CtOrigin -> Arity -> TcSigmaType -> [TcSigmaType] -> Arity -> TcM (HsWrapper, [TcSigmaType], TcSigmaType)

Variant of matchActualFunTys that works when supplied only part (that is, to the right of some arrows) of the full function type

matchExpectedFunKind

Arguments

:: Arity

# of args remaining, only for errors

-> TcType

type, only for errors

-> TcKind

function kind

-> TcM (Coercion, TcKind, TcKind)

co :: old_kind ~ arg -> res

Breaks apart a function kind into its pieces.