ghc-6.12.3: The GHC APISource codeContentsIndex
TcType
Synopsis
type TcType = Type
type TcSigmaType = TcType
type TcRhoType = TcType
type TcTauType = TcType
type TcPredType = PredType
type TcThetaType = ThetaType
type TcTyVar = TyVar
type TcTyVarSet = TyVarSet
type TcKind = Kind
type BoxyTyVar = TcTyVar
type BoxySigmaType = TcType
type BoxyRhoType = TcType
type BoxyThetaType = TcThetaType
type BoxyType = TcType
data UserTypeCtxt
= FunSigCtxt Name
| ExprSigCtxt
| ConArgCtxt Name
| TySynCtxt Name
| GenPatCtxt
| LamPatSigCtxt
| BindPatSigCtxt
| ResSigCtxt
| ForSigCtxt Name
| DefaultDeclCtxt
| SpecInstCtxt
| ThBrackCtxt
pprUserTypeCtxt :: UserTypeCtxt -> SDoc
data TcTyVarDetails
= SkolemTv SkolemInfo
| MetaTv BoxInfo (IORef MetaDetails)
data BoxInfo
= BoxTv
| TauTv
| SigTv SkolemInfo
pprTcTyVarDetails :: TcTyVarDetails -> SDoc
data MetaDetails
= Flexi
| Indirect TcType
data SkolemInfo
= SigSkol UserTypeCtxt
| ClsSkol Class
| InstSkol
| FamInstSkol
| PatSkol DataCon
| ArrowSkol
| RuleSkol RuleName
| GenSkol [TcTyVar] TcType
| RuntimeUnkSkol
| UnkSkol
pprSkolTvBinding :: TcTyVar -> SDoc
pprSkolInfo :: SkolemInfo -> SDoc
isImmutableTyVar :: TyVar -> Bool
isSkolemTyVar :: TcTyVar -> Bool
isMetaTyVar :: TcTyVar -> Bool
isBoxyTyVar :: TcTyVar -> Bool
isSigTyVar :: Var -> Bool
isExistentialTyVar :: TcTyVar -> Bool
isTyConableTyVar :: TcTyVar -> Bool
metaTvRef :: TyVar -> IORef MetaDetails
isFlexi :: MetaDetails -> Bool
isIndirect :: MetaDetails -> Bool
isRuntimeUnk :: TyVar -> Bool
isUnk :: TyVar -> Bool
mkPhiTy :: [PredType] -> Type -> Type
mkSigmaTy :: [TyVar] -> [PredType] -> Type -> Type
tcView :: Type -> Maybe Type
tcSplitForAllTys :: Type -> ([TyVar], Type)
tcSplitPhiTy :: Type -> (ThetaType, Type)
tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type)
tcSplitFunTy_maybe :: Type -> Maybe (Type, Type)
tcSplitFunTys :: Type -> ([Type], Type)
tcFunArgTy :: Type -> Type
tcFunResultTy :: Type -> Type
tcSplitFunTysN :: TcRhoType -> Arity -> ([TcSigmaType], TcSigmaType)
tcSplitTyConApp :: Type -> (TyCon, [Type])
tcSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type])
tcTyConAppTyCon :: Type -> TyCon
tcTyConAppArgs :: Type -> [Type]
tcSplitAppTy_maybe :: Type -> Maybe (Type, Type)
tcSplitAppTy :: Type -> (Type, Type)
tcSplitAppTys :: Type -> (Type, [Type])
repSplitAppTy_maybe :: Type -> Maybe (Type, Type)
tcInstHeadTyNotSynonym :: Type -> Bool
tcInstHeadTyAppAllTyVars :: Type -> Bool
tcGetTyVar_maybe :: Type -> Maybe TyVar
tcGetTyVar :: String -> Type -> TyVar
tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)
tcMultiSplitSigmaTy :: TcSigmaType -> ([([TyVar], ThetaType)], TcSigmaType)
tcEqType :: Type -> Type -> Bool
tcEqTypes :: [Type] -> [Type] -> Bool
tcEqPred :: PredType -> PredType -> Bool
tcCmpType :: Type -> Type -> Ordering
tcCmpTypes :: [Type] -> [Type] -> Ordering
tcCmpPred :: PredType -> PredType -> Ordering
tcEqTypeX :: RnEnv2 -> Type -> Type -> Bool
eqKind :: Kind -> Kind -> Bool
isSigmaTy :: Type -> Bool
isOverloadedTy :: Type -> Bool
isRigidTy :: TcType -> Bool
isBoxyTy :: TcType -> Bool
isDoubleTy :: Type -> Bool
isFloatTy :: Type -> Bool
isIntTy :: Type -> Bool
isWordTy :: Type -> Bool
isStringTy :: Type -> Bool
isIntegerTy :: Type -> Bool
isBoolTy :: Type -> Bool
isUnitTy :: Type -> Bool
isCharTy :: Type -> Bool
isTauTy :: Type -> Bool
isTauTyCon :: TyCon -> Bool
tcIsTyVarTy :: Type -> Bool
tcIsForAllTy :: Type -> Bool
isOpenSynTyConApp :: TcTauType -> Bool
deNoteType :: Type -> Type
tyClsNamesOfType :: Type -> NameSet
tyClsNamesOfDFunHead :: Type -> NameSet
getDFunTyKey :: Type -> OccName
getClassPredTys_maybe :: PredType -> Maybe (Class, [Type])
getClassPredTys :: PredType -> (Class, [Type])
isClassPred :: PredType -> Bool
isTyVarClassPred :: PredType -> Bool
isEqPred :: PredType -> Bool
mkDictTy :: Class -> [Type] -> Type
tcSplitPredTy_maybe :: Type -> Maybe PredType
isPredTy :: Type -> Bool
isDictTy :: Type -> Bool
isDictLikeTy :: Type -> Bool
tcSplitDFunTy :: Type -> ([TyVar], [PredType], Class, [Type])
tcSplitDFunHead :: Type -> (Class, [Type])
predTyUnique :: PredType -> Unique
mkClassPred :: Class -> [Type] -> PredType
isInheritablePred :: PredType -> Bool
isIPPred :: PredType -> Bool
isRefineableTy :: TcType -> (Bool, Bool)
isRefineablePred :: TcPredType -> Bool
isFFIArgumentTy :: DynFlags -> Safety -> Type -> Bool
isFFIImportResultTy :: DynFlags -> Type -> Bool
isFFIExportResultTy :: Type -> Bool
isFFIExternalTy :: Type -> Bool
isFFIDynArgumentTy :: Type -> Bool
isFFIDynResultTy :: Type -> Bool
isFFIPrimArgumentTy :: DynFlags -> Type -> Bool
isFFIPrimResultTy :: DynFlags -> Type -> Bool
isFFILabelTy :: Type -> Bool
isFFIDotnetTy :: DynFlags -> Type -> Bool
isFFIDotnetObjTy :: Type -> Bool
isFFITy :: Type -> Bool
isFunPtrTy :: Type -> Bool
tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type, CoercionI)
type Kind = Type
unliftedTypeKind :: Kind
liftedTypeKind :: Kind
argTypeKind :: Kind
openTypeKind :: Kind
mkArrowKind :: Kind -> Kind -> Kind
mkArrowKinds :: [Kind] -> Kind -> Kind
isLiftedTypeKind :: Kind -> Bool
isUnliftedTypeKind :: Kind -> Bool
isSubOpenTypeKind :: Kind -> Bool
isSubArgTypeKind :: Kind -> Bool
isSubKind :: Kind -> Kind -> Bool
splitKindFunTys :: Kind -> ([Kind], Kind)
defaultKind :: Kind -> Kind
kindVarRef :: KindVar -> IORef MetaDetails
mkKindVar :: Unique -> IORef MetaDetails -> KindVar
data Type
data PredType
= ClassP Class [Type]
| IParam (IPName Name) Type
| EqPred Type Type
type ThetaType = [PredType]
mkForAllTy :: TyVar -> Type -> Type
mkForAllTys :: [TyVar] -> Type -> Type
mkFunTy :: Type -> Type -> Type
mkFunTys :: [Type] -> Type -> Type
zipFunTys :: Outputable a => [a] -> Type -> ([(a, Type)], Type)
mkTyConApp :: TyCon -> [Type] -> Type
mkAppTy :: Type -> Type -> Type
mkAppTys :: Type -> [Type] -> Type
applyTy :: Type -> Type -> Type
applyTys :: Type -> [Type] -> Type
mkTyVarTy :: TyVar -> Type
mkTyVarTys :: [TyVar] -> [Type]
mkTyConTy :: TyCon -> Type
mkPredTy :: PredType -> Type
mkPredTys :: ThetaType -> [Type]
data TvSubst = TvSubst InScopeSet TvSubstEnv
type TvSubstEnv = TyVarEnv Type
emptyTvSubst :: TvSubst
substEqSpec :: TvSubst -> [(TyVar, Type)] -> [(TcType, TcType)]
mkOpenTvSubst :: TvSubstEnv -> TvSubst
zipOpenTvSubst :: [TyVar] -> [Type] -> TvSubst
zipTopTvSubst :: [TyVar] -> [Type] -> TvSubst
mkTopTvSubst :: [(TyVar, Type)] -> TvSubst
notElemTvSubst :: TyVar -> TvSubst -> Bool
getTvSubstEnv :: TvSubst -> TvSubstEnv
setTvSubstEnv :: TvSubst -> TvSubstEnv -> TvSubst
getTvInScope :: TvSubst -> InScopeSet
extendTvInScope :: TvSubst -> [Var] -> TvSubst
lookupTyVar :: TvSubst -> TyVar -> Maybe Type
extendTvSubst :: TvSubst -> TyVar -> Type -> TvSubst
extendTvSubstList :: TvSubst -> [TyVar] -> [Type] -> TvSubst
isInScope :: Var -> TvSubst -> Bool
mkTvSubst :: InScopeSet -> TvSubstEnv -> TvSubst
zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv
substTy :: TvSubst -> Type -> Type
substTys :: TvSubst -> [Type] -> [Type]
substTyWith :: [TyVar] -> [Type] -> Type -> Type
substTheta :: TvSubst -> ThetaType -> ThetaType
substTyVar :: TvSubst -> TyVar -> Type
substTyVars :: TvSubst -> [TyVar] -> [Type]
substTyVarBndr :: TvSubst -> TyVar -> (TvSubst, TyVar)
isUnLiftedType :: Type -> Bool
isUnboxedTupleType :: Type -> Bool
isPrimitiveType :: Type -> Bool
tidyTopType :: Type -> Type
tidyType :: TidyEnv -> Type -> Type
tidyPred :: TidyEnv -> PredType -> PredType
tidyTypes :: TidyEnv -> [Type] -> [Type]
tidyFreeTyVars :: TidyEnv -> TyVarSet -> TidyEnv
tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
tidyTyVarBndr :: TidyEnv -> TyVar -> (TidyEnv, TyVar)
tidyOpenTyVar :: TidyEnv -> TyVar -> (TidyEnv, TyVar)
tidyOpenTyVars :: TidyEnv -> [TyVar] -> (TidyEnv, [TyVar])
tidySkolemTyVar :: TidyEnv -> TcTyVar -> (TidyEnv, TcTyVar)
typeKind :: Type -> Kind
tidyKind :: TidyEnv -> Kind -> (TidyEnv, Kind)
tyVarsOfType :: Type -> TyVarSet
tyVarsOfTypes :: [Type] -> TyVarSet
tyVarsOfPred :: PredType -> TyVarSet
tyVarsOfTheta :: ThetaType -> TyVarSet
tcTyVarsOfType :: Type -> TcTyVarSet
tcTyVarsOfTypes :: [Type] -> TyVarSet
tcTyVarsOfPred :: PredType -> TyVarSet
exactTyVarsOfType :: TcType -> TyVarSet
exactTyVarsOfTypes :: [TcType] -> TyVarSet
pprKind :: Kind -> SDoc
pprParendKind :: Kind -> SDoc
pprType :: Type -> SDoc
pprParendType :: Type -> SDoc
pprTypeApp :: NamedThing a => a -> [Type] -> SDoc
pprTyThingCategory :: TyThing -> SDoc
pprPred :: PredType -> SDoc
pprTheta :: ThetaType -> SDoc
pprThetaArrow :: ThetaType -> SDoc
pprClassPred :: Class -> [Type] -> SDoc
Documentation
type TcType = TypeSource
type TcSigmaType = TcTypeSource
type TcRhoType = TcTypeSource
type TcTauType = TcTypeSource
type TcPredType = PredTypeSource
type TcThetaType = ThetaTypeSource
type TcTyVar = TyVarSource
type TcTyVarSet = TyVarSetSource
type TcKind = KindSource
type BoxyTyVar = TcTyVarSource
type BoxySigmaType = TcTypeSource
type BoxyRhoType = TcTypeSource
type BoxyThetaType = TcThetaTypeSource
type BoxyType = TcTypeSource
data UserTypeCtxt Source
Constructors
FunSigCtxt Name
ExprSigCtxt
ConArgCtxt Name
TySynCtxt Name
GenPatCtxt
LamPatSigCtxt
BindPatSigCtxt
ResSigCtxt
ForSigCtxt Name
DefaultDeclCtxt
SpecInstCtxt
ThBrackCtxt
pprUserTypeCtxt :: UserTypeCtxt -> SDocSource
data TcTyVarDetails Source
Constructors
SkolemTv SkolemInfo
MetaTv BoxInfo (IORef MetaDetails)
data BoxInfo Source
Constructors
BoxTv
TauTv
SigTv SkolemInfo
pprTcTyVarDetails :: TcTyVarDetails -> SDocSource
data MetaDetails Source
Constructors
Flexi
Indirect TcType
show/hide Instances
data SkolemInfo Source
Constructors
SigSkol UserTypeCtxt
ClsSkol Class
InstSkol
FamInstSkol
PatSkol DataCon
ArrowSkol
RuleSkol RuleName
GenSkol [TcTyVar] TcType
RuntimeUnkSkol
UnkSkol
pprSkolTvBinding :: TcTyVar -> SDocSource
pprSkolInfo :: SkolemInfo -> SDocSource
isImmutableTyVar :: TyVar -> BoolSource
isSkolemTyVar :: TcTyVar -> BoolSource
isMetaTyVar :: TcTyVar -> BoolSource
isBoxyTyVar :: TcTyVar -> BoolSource
isSigTyVar :: Var -> BoolSource
isExistentialTyVar :: TcTyVar -> BoolSource
isTyConableTyVar :: TcTyVar -> BoolSource
metaTvRef :: TyVar -> IORef MetaDetailsSource
isFlexi :: MetaDetails -> BoolSource
isIndirect :: MetaDetails -> BoolSource
isRuntimeUnk :: TyVar -> BoolSource
isUnk :: TyVar -> BoolSource
mkPhiTy :: [PredType] -> Type -> TypeSource
mkSigmaTy :: [TyVar] -> [PredType] -> Type -> TypeSource
tcView :: Type -> Maybe TypeSource
Similar to coreView, but for the type checker, which just looks through synonyms
tcSplitForAllTys :: Type -> ([TyVar], Type)Source
tcSplitPhiTy :: Type -> (ThetaType, Type)Source
tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type)Source
tcSplitFunTy_maybe :: Type -> Maybe (Type, Type)Source
tcSplitFunTys :: Type -> ([Type], Type)Source
tcFunArgTy :: Type -> TypeSource
tcFunResultTy :: Type -> TypeSource
tcSplitFunTysN :: TcRhoType -> Arity -> ([TcSigmaType], TcSigmaType)Source
tcSplitTyConApp :: Type -> (TyCon, [Type])Source
tcSplitTyConApp_maybe :: Type -> Maybe (TyCon, [Type])Source
tcTyConAppTyCon :: Type -> TyConSource
tcTyConAppArgs :: Type -> [Type]Source
tcSplitAppTy_maybe :: Type -> Maybe (Type, Type)Source
tcSplitAppTy :: Type -> (Type, Type)Source
tcSplitAppTys :: Type -> (Type, [Type])Source
repSplitAppTy_maybe :: Type -> Maybe (Type, Type)Source
Does the AppTy split as in splitAppTy_maybe, but assumes that any Core view stuff is already done
tcInstHeadTyNotSynonym :: Type -> BoolSource
tcInstHeadTyAppAllTyVars :: Type -> BoolSource
tcGetTyVar_maybe :: Type -> Maybe TyVarSource
tcGetTyVar :: String -> Type -> TyVarSource
tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type)Source
tcMultiSplitSigmaTy :: TcSigmaType -> ([([TyVar], ThetaType)], TcSigmaType)Source
tcEqType :: Type -> Type -> BoolSource
Type equality on source types. Does not look through newtypes or PredTypes, but it does look through type synonyms.
tcEqTypes :: [Type] -> [Type] -> BoolSource
tcEqPred :: PredType -> PredType -> BoolSource
tcCmpType :: Type -> Type -> OrderingSource
Type ordering on source types. Does not look through newtypes or PredTypes, but it does look through type synonyms.
tcCmpTypes :: [Type] -> [Type] -> OrderingSource
tcCmpPred :: PredType -> PredType -> OrderingSource
tcEqTypeX :: RnEnv2 -> Type -> Type -> BoolSource
eqKind :: Kind -> Kind -> BoolSource
isSigmaTy :: Type -> BoolSource
isOverloadedTy :: Type -> BoolSource
isRigidTy :: TcType -> BoolSource
isBoxyTy :: TcType -> BoolSource
isDoubleTy :: Type -> BoolSource
isFloatTy :: Type -> BoolSource
isIntTy :: Type -> BoolSource
isWordTy :: Type -> BoolSource
isStringTy :: Type -> BoolSource
isIntegerTy :: Type -> BoolSource
isBoolTy :: Type -> BoolSource
isUnitTy :: Type -> BoolSource
isCharTy :: Type -> BoolSource
isTauTy :: Type -> BoolSource
isTauTyCon :: TyCon -> BoolSource
tcIsTyVarTy :: Type -> BoolSource
tcIsForAllTy :: Type -> BoolSource
isOpenSynTyConApp :: TcTauType -> BoolSource
deNoteType :: Type -> TypeSource
tyClsNamesOfType :: Type -> NameSetSource
tyClsNamesOfDFunHead :: Type -> NameSetSource
getDFunTyKey :: Type -> OccNameSource
getClassPredTys_maybe :: PredType -> Maybe (Class, [Type])Source
getClassPredTys :: PredType -> (Class, [Type])Source
isClassPred :: PredType -> BoolSource
isTyVarClassPred :: PredType -> BoolSource
isEqPred :: PredType -> BoolSource
mkDictTy :: Class -> [Type] -> TypeSource
tcSplitPredTy_maybe :: Type -> Maybe PredTypeSource
isPredTy :: Type -> BoolSource
isDictTy :: Type -> BoolSource
isDictLikeTy :: Type -> BoolSource
tcSplitDFunTy :: Type -> ([TyVar], [PredType], Class, [Type])Source
tcSplitDFunHead :: Type -> (Class, [Type])Source
predTyUnique :: PredType -> UniqueSource
mkClassPred :: Class -> [Type] -> PredTypeSource
isInheritablePred :: PredType -> BoolSource
isIPPred :: PredType -> BoolSource
isRefineableTy :: TcType -> (Bool, Bool)Source
isRefineablePred :: TcPredType -> BoolSource
isFFIArgumentTy :: DynFlags -> Safety -> Type -> BoolSource
isFFIImportResultTy :: DynFlags -> Type -> BoolSource
isFFIExportResultTy :: Type -> BoolSource
isFFIExternalTy :: Type -> BoolSource
isFFIDynArgumentTy :: Type -> BoolSource
isFFIDynResultTy :: Type -> BoolSource
isFFIPrimArgumentTy :: DynFlags -> Type -> BoolSource
isFFIPrimResultTy :: DynFlags -> Type -> BoolSource
isFFILabelTy :: Type -> BoolSource
isFFIDotnetTy :: DynFlags -> Type -> BoolSource
isFFIDotnetObjTy :: Type -> BoolSource
isFFITy :: Type -> BoolSource
isFunPtrTy :: Type -> BoolSource
tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type, CoercionI)Source
type Kind = TypeSource

The key type representing kinds in the compiler. Invariant: a kind is always in one of these forms:

 FunTy k1 k2
 TyConApp PrimTyCon [...]
 TyVar kv   -- (during inference only)
 ForAll ... -- (for top-level coercions)
unliftedTypeKind :: KindSource
See Type for details of the distinction between these Kinds
liftedTypeKind :: KindSource
argTypeKind :: KindSource
openTypeKind :: KindSource
mkArrowKind :: Kind -> Kind -> KindSource
Given two kinds k1 and k2, creates the Kind k1 -> k2
mkArrowKinds :: [Kind] -> Kind -> KindSource
Iterated application of mkArrowKind
isLiftedTypeKind :: Kind -> BoolSource
isUnliftedTypeKind :: Kind -> BoolSource
isSubOpenTypeKind :: Kind -> BoolSource
True of any sub-kind of OpenTypeKind (i.e. anything except arrow)
isSubArgTypeKind :: Kind -> BoolSource
True of any sub-kind of ArgTypeKind
isSubKind :: Kind -> Kind -> BoolSource
k1 `isSubKind` k2 checks that k1 <: k2
splitKindFunTys :: Kind -> ([Kind], Kind)Source
Essentially splitFunTys on kinds
defaultKind :: Kind -> KindSource
Used when generalising: default kind ? and ?? to *. See Type for more information on what that means
kindVarRef :: KindVar -> IORef MetaDetailsSource
mkKindVar :: Unique -> IORef MetaDetails -> KindVarSource
data Type Source
The key representation of types within the compiler
show/hide Instances
data PredType Source

A type of the form PredTy p represents a value whose type is the Haskell predicate p, where a predicate is what occurs before the => in a Haskell type. It can be expanded into its representation, but:

  • The type checker must treat it as opaque
  • The rest of the compiler treats it as transparent

Consider these examples:

 f :: (Eq a) => a -> Int
 g :: (?x :: Int -> Int) => a -> Int
 h :: (r\l) => {r} => {l::Int | r}

Here the Eq a and ?x :: Int -> Int and rl are all called "predicates"

Constructors
ClassP Class [Type]Class predicate e.g. Eq a
IParam (IPName Name) TypeImplicit parameter e.g. ?x :: Int
EqPred Type TypeEquality predicate e.g ty1 ~ ty2
show/hide Instances
type ThetaType = [PredType]Source
A collection of PredTypes
mkForAllTy :: TyVar -> Type -> TypeSource
mkForAllTys :: [TyVar] -> Type -> TypeSource
Wraps foralls over the type using the provided TyVars from left to right
mkFunTy :: Type -> Type -> TypeSource
Creates a function type from the given argument and result type
mkFunTys :: [Type] -> Type -> TypeSource
zipFunTys :: Outputable a => [a] -> Type -> ([(a, Type)], Type)Source
Splits off argument types from the given type and associating them with the things in the input list from left to right. The final result type is returned, along with the resulting pairs of objects and types, albeit with the list of pairs in reverse order. Panics if there are not enough argument types for the input list.
mkTyConApp :: TyCon -> [Type] -> TypeSource
A key function: builds a TyConApp or FunTy as apppropriate to its arguments. Applies its arguments to the constructor from left to right
mkAppTy :: Type -> Type -> TypeSource
Applies a type to another, as in e.g. k a
mkAppTys :: Type -> [Type] -> TypeSource
applyTy :: Type -> Type -> TypeSource

Instantiate a forall type with one or more type arguments. Used when we have a polymorphic function applied to type args:

 f t1 t2

We use applyTys type-of-f [t1,t2] to compute the type of the expression. Panics if no application is possible.

applyTys :: Type -> [Type] -> TypeSource

This function is interesting because:

1. The function may have more for-alls than there are args

2. Less obviously, it may have fewer for-alls

For case 2. think of:

 applyTys (forall a.a) [forall b.b, Int]

This really can happen, via dressing up polymorphic types with newtype clothing. Here's an example:

 newtype R = R (forall a. a->a)
 foo = case undefined :: R of
            R f -> f ()
mkTyVarTy :: TyVar -> TypeSource
mkTyVarTys :: [TyVar] -> [Type]Source
mkTyConTy :: TyCon -> TypeSource
Create the plain type constructor type which has been applied to no type arguments at all.
mkPredTy :: PredType -> TypeSource
mkPredTys :: ThetaType -> [Type]Source
data TvSubst Source

Type substitution

The following invariants must hold of a TvSubst:

1. The in-scope set is needed only to guide the generation of fresh uniques

2. In particular, the kind of the type variables in the in-scope set is not relevant

3. The substition is only applied ONCE! This is because in general such application will not reached a fixed point.

Constructors
TvSubst InScopeSet TvSubstEnv
show/hide Instances
type TvSubstEnv = TyVarEnv TypeSource
A substitition of Types for TyVars
emptyTvSubst :: TvSubstSource
substEqSpec :: TvSubst -> [(TyVar, Type)] -> [(TcType, TcType)]Source
mkOpenTvSubst :: TvSubstEnv -> TvSubstSource
Generates the in-scope set for the TvSubst from the types in the incoming environment, hence open
zipOpenTvSubst :: [TyVar] -> [Type] -> TvSubstSource
Generates the in-scope set for the TvSubst from the types in the incoming environment, hence open
zipTopTvSubst :: [TyVar] -> [Type] -> TvSubstSource
mkTopTvSubst :: [(TyVar, Type)] -> TvSubstSource
Called when doing top-level substitutions. Here we expect that the free vars of the range of the substitution will be empty.
notElemTvSubst :: TyVar -> TvSubst -> BoolSource
getTvSubstEnv :: TvSubst -> TvSubstEnvSource
setTvSubstEnv :: TvSubst -> TvSubstEnv -> TvSubstSource
getTvInScope :: TvSubst -> InScopeSetSource
extendTvInScope :: TvSubst -> [Var] -> TvSubstSource
lookupTyVar :: TvSubst -> TyVar -> Maybe TypeSource
extendTvSubst :: TvSubst -> TyVar -> Type -> TvSubstSource
extendTvSubstList :: TvSubst -> [TyVar] -> [Type] -> TvSubstSource
isInScope :: Var -> TvSubst -> BoolSource
mkTvSubst :: InScopeSet -> TvSubstEnv -> TvSubstSource
zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnvSource
substTy :: TvSubst -> Type -> TypeSource
Substitute within a Type
substTys :: TvSubst -> [Type] -> [Type]Source
Substitute within several Types
substTyWith :: [TyVar] -> [Type] -> Type -> TypeSource
Type substitution making use of an TvSubst that is assumed to be open, see zipOpenTvSubst
substTheta :: TvSubst -> ThetaType -> ThetaTypeSource
Substitute within a ThetaType
substTyVar :: TvSubst -> TyVar -> TypeSource
substTyVars :: TvSubst -> [TyVar] -> [Type]Source
substTyVarBndr :: TvSubst -> TyVar -> (TvSubst, TyVar)Source
isUnLiftedType :: Type -> BoolSource
See Type for what an unlifted type is
isUnboxedTupleType :: Type -> BoolSource
isPrimitiveType :: Type -> BoolSource
Returns true of types that are opaque to Haskell. Most of these are unlifted, but now that we interact with .NET, we may have primtive (foreign-imported) types that are lifted
tidyTopType :: Type -> TypeSource
Calls tidyType on a top-level type (i.e. with an empty tidying environment)
tidyType :: TidyEnv -> Type -> TypeSource
tidyPred :: TidyEnv -> PredType -> PredTypeSource
tidyTypes :: TidyEnv -> [Type] -> [Type]Source
tidyFreeTyVars :: TidyEnv -> TyVarSet -> TidyEnvSource
Add the free TyVars to the env in tidy form, so that we can tidy the type they are free in
tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)Source
Grabs the free type variables, tidies them and then uses tidyType to work over the type itself
tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])Source
tidyTyVarBndr :: TidyEnv -> TyVar -> (TidyEnv, TyVar)Source

This tidies up a type for printing in an error message, or in an interface file.

It doesn't change the uniques at all, just the print names.

tidyOpenTyVar :: TidyEnv -> TyVar -> (TidyEnv, TyVar)Source
Treat a new TyVar as a binder, and give it a fresh tidy name using the environment if one has not already been allocated. See also tidyTyVarBndr
tidyOpenTyVars :: TidyEnv -> [TyVar] -> (TidyEnv, [TyVar])Source
tidySkolemTyVar :: TidyEnv -> TcTyVar -> (TidyEnv, TcTyVar)Source
typeKind :: Type -> KindSource
tidyKind :: TidyEnv -> Kind -> (TidyEnv, Kind)Source
tyVarsOfType :: Type -> TyVarSetSource
NB: for type synonyms tyVarsOfType does not expand the synonym
tyVarsOfTypes :: [Type] -> TyVarSetSource
tyVarsOfPred :: PredType -> TyVarSetSource
tyVarsOfTheta :: ThetaType -> TyVarSetSource
tcTyVarsOfType :: Type -> TcTyVarSetSource
tcTyVarsOfTypes :: [Type] -> TyVarSetSource
tcTyVarsOfPred :: PredType -> TyVarSetSource
exactTyVarsOfType :: TcType -> TyVarSetSource
exactTyVarsOfTypes :: [TcType] -> TyVarSetSource
pprKind :: Kind -> SDocSource
pprParendKind :: Kind -> SDocSource
pprType :: Type -> SDocSource
pprParendType :: Type -> SDocSource
pprTypeApp :: NamedThing a => a -> [Type] -> SDocSource
pprTyThingCategory :: TyThing -> SDocSource
pprPred :: PredType -> SDocSource
pprTheta :: ThetaType -> SDocSource
pprThetaArrow :: ThetaType -> SDocSource
pprClassPred :: Class -> [Type] -> SDocSource
Produced by Haddock version 2.6.1