| |||||||||||||||||||||||

| |||||||||||||||||||||||

| |||||||||||||||||||||||

Description | |||||||||||||||||||||||

Main functions for manipulating types and type-related things | |||||||||||||||||||||||

Synopsis | |||||||||||||||||||||||

Main data types representing Types | |||||||||||||||||||||||

Types are one of: - Unboxed
- Iff its representation is other than a pointer Unboxed types are also unlifted.
- Lifted
- Iff it has bottom as an element. Closures always have lifted types: i.e. any let-bound identifier in Core must have a lifted type. Operationally, a lifted object is one that can be entered. Only lifted types may be unified with a type variable.
- Algebraic
- Iff it is a type with one or more constructors, whether
declared with
`data`or`newtype`. An algebraic type is one that can be deconstructed with a case expression. This is*not*the same as lifted types, because we also include unboxed tuples in this classification. - Data
- Iff it is a type declared with
`data`, or a boxed tuple. - Primitive
- Iff it is a built-in type that can't be expressed in Haskell.
Currently, all primitive types are unlifted, but that's not necessarily
the case: for example, Some primitive types are unboxed, such as Some examples of type classifications that may make this a bit clearer are: Type primitive boxed lifted algebraic ----------------------------------------------------------------------------- Int# Yes No No No ByteArray# Yes Yes No No (# a, b #) Yes No No Yes ( a, b ) No Yes Yes Yes [a] No Yes Yes Yes | |||||||||||||||||||||||

A You don't normally have to worry about this, as the utility functions in this module will automatically convert a source into a representation type if they are spotted, to the best of it's abilities. If you don't want this to happen, use the equivalent functions from the TcType module. | |||||||||||||||||||||||

data TyThing | |||||||||||||||||||||||

| |||||||||||||||||||||||

data Type | |||||||||||||||||||||||

| |||||||||||||||||||||||

data PredType | |||||||||||||||||||||||

| |||||||||||||||||||||||

type ThetaType = [PredType] | |||||||||||||||||||||||

A collection of PredTypes
| |||||||||||||||||||||||

Constructing and deconstructing types | |||||||||||||||||||||||

mkTyVarTy :: TyVar -> Type | |||||||||||||||||||||||

mkTyVarTys :: [TyVar] -> [Type] | |||||||||||||||||||||||

getTyVar :: String -> Type -> TyVar | |||||||||||||||||||||||

Attempts to obtain the type variable underlying a Type, and panics with the
given message if this is not a type variable type. See also getTyVar_maybe
| |||||||||||||||||||||||

getTyVar_maybe :: Type -> Maybe TyVar | |||||||||||||||||||||||

Attempts to obtain the type variable underlying a Type
| |||||||||||||||||||||||

mkAppTy :: Type -> Type -> Type | |||||||||||||||||||||||

Applies a type to another, as in e.g. k a
| |||||||||||||||||||||||

mkAppTys :: Type -> [Type] -> Type | |||||||||||||||||||||||

splitAppTy :: Type -> (Type, Type) | |||||||||||||||||||||||

Attempts to take a type application apart, as in splitAppTy_maybe,
and panics if this is not possible
| |||||||||||||||||||||||

splitAppTys :: Type -> (Type, [Type]) | |||||||||||||||||||||||

Recursively splits a type as far as is possible, leaving a residual type being applied to and the type arguments applied to it. Never fails, even if that means returning an empty list of type applications. | |||||||||||||||||||||||

splitAppTy_maybe :: Type -> Maybe (Type, Type) | |||||||||||||||||||||||

Attempt to take a type application apart, whether it is a function, type constructor, or plain type application. Note that type family applications are NEVER unsaturated by this! | |||||||||||||||||||||||

repSplitAppTy_maybe :: Type -> Maybe (Type, Type) | |||||||||||||||||||||||

Does the AppTy split as in splitAppTy_maybe, but assumes that
any Core view stuff is already done
| |||||||||||||||||||||||

mkFunTy :: Type -> Type -> Type | |||||||||||||||||||||||

Creates a function type from the given argument and result type | |||||||||||||||||||||||

mkFunTys :: [Type] -> Type -> Type | |||||||||||||||||||||||

splitFunTy :: Type -> (Type, Type) | |||||||||||||||||||||||

Attempts to extract the argument and result types from a type, and
panics if that is not possible. See also splitFunTy_maybe
| |||||||||||||||||||||||

splitFunTy_maybe :: Type -> Maybe (Type, Type) | |||||||||||||||||||||||

Attempts to extract the argument and result types from a type | |||||||||||||||||||||||

splitFunTys :: Type -> ([Type], Type) | |||||||||||||||||||||||

splitFunTysN :: Int -> Type -> ([Type], Type) | |||||||||||||||||||||||

Split off exactly the given number argument types, and panics if that is not possible | |||||||||||||||||||||||

funResultTy :: Type -> Type | |||||||||||||||||||||||

Extract the function result type and panic if that is not possible | |||||||||||||||||||||||

funArgTy :: Type -> Type | |||||||||||||||||||||||

Extract the function argument type and panic if that is not possible | |||||||||||||||||||||||

zipFunTys :: Outputable a => [a] -> Type -> ([(a, Type)], Type) | |||||||||||||||||||||||

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] -> Type | |||||||||||||||||||||||

A key function: builds a TyConApp or FunTy as apppropriate to its arguments.
Applies its arguments to the constructor from left to right
| |||||||||||||||||||||||

mkTyConTy :: TyCon -> Type | |||||||||||||||||||||||

Create the plain type constructor type which has been applied to no type arguments at all. | |||||||||||||||||||||||

tyConAppTyCon :: Type -> TyCon | |||||||||||||||||||||||

The same as fst . splitTyConApp
| |||||||||||||||||||||||

tyConAppArgs :: Type -> [Type] | |||||||||||||||||||||||

The same as snd . splitTyConApp
| |||||||||||||||||||||||

splitTyConApp_maybe :: Type -> Maybe (TyCon, [Type]) | |||||||||||||||||||||||

Attempts to tease a type apart into a type constructor and the application of a number of arguments to that constructor | |||||||||||||||||||||||

splitTyConApp :: Type -> (TyCon, [Type]) | |||||||||||||||||||||||

Attempts to tease a type apart into a type constructor and the application
of a number of arguments to that constructor. Panics if that is not possible.
See also splitTyConApp_maybe
| |||||||||||||||||||||||

mkForAllTy :: TyVar -> Type -> Type | |||||||||||||||||||||||

mkForAllTys :: [TyVar] -> Type -> Type | |||||||||||||||||||||||

Wraps foralls over the type using the provided TyVars from left to right
| |||||||||||||||||||||||

splitForAllTy_maybe :: Type -> Maybe (TyVar, Type) | |||||||||||||||||||||||

Attempts to take a forall type apart, returning the bound type variable and the remainder of the type | |||||||||||||||||||||||

splitForAllTys :: Type -> ([TyVar], Type) | |||||||||||||||||||||||

Attempts to take a forall type apart, returning all the immediate such bound
type variables and the remainder of the type. Always suceeds, even if that means
returning an empty list of TyVars
| |||||||||||||||||||||||

applyTy :: Type -> Type -> Type | |||||||||||||||||||||||

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 -> [Type] -> Type | |||||||||||||||||||||||

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 () | |||||||||||||||||||||||

applyTysD :: SDoc -> Type -> [Type] -> Type | |||||||||||||||||||||||

isForAllTy :: Type -> Bool | |||||||||||||||||||||||

dropForAlls :: Type -> Type | |||||||||||||||||||||||

Equivalent to snd . splitForAllTys
| |||||||||||||||||||||||

newTyConInstRhs :: TyCon -> [Type] -> Type | |||||||||||||||||||||||

Unwrap one layer of newtype on a type constructor and it's arguments, using an
eta-reduced version of the newtype if possible
| |||||||||||||||||||||||

carefullySplitNewType_maybe :: [TyCon] -> TyCon -> [Type] -> Maybe ([TyCon], Type) | |||||||||||||||||||||||

tyFamInsts :: Type -> [(TyCon, [Type])] | |||||||||||||||||||||||

Finds type family instances occuring in a type after expanding synonyms. | |||||||||||||||||||||||

predFamInsts :: PredType -> [(TyCon, [Type])] | |||||||||||||||||||||||

Finds type family instances occuring in a predicate type after expanding synonyms. | |||||||||||||||||||||||

mkPredTy :: PredType -> Type | |||||||||||||||||||||||

mkPredTys :: ThetaType -> [Type] | |||||||||||||||||||||||

mkFamilyTyConApp :: TyCon -> [Type] -> Type | |||||||||||||||||||||||

Given a family instance TyCon and its arg types, return the corresponding family type. E.g: data family T a data instance T (Maybe b) = MkT b Where the instance tycon is :RTL, so: mkFamilyTyConApp :RTL Int = T (Maybe Int) | |||||||||||||||||||||||

Common type constructors | |||||||||||||||||||||||

funTyCon :: TyCon | |||||||||||||||||||||||

Predicates on types | |||||||||||||||||||||||

isTyVarTy :: Type -> Bool | |||||||||||||||||||||||

isFunTy :: Type -> Bool | |||||||||||||||||||||||

isUnLiftedType :: Type -> Bool | |||||||||||||||||||||||

See Type for what an unlifted type is | |||||||||||||||||||||||

isUnboxedTupleType :: Type -> Bool | |||||||||||||||||||||||

isAlgType :: Type -> Bool | |||||||||||||||||||||||

See Type for what an algebraic type is.
Should only be applied to types, as opposed to e.g. partially
saturated type constructors
| |||||||||||||||||||||||

isClosedAlgType :: Type -> Bool | |||||||||||||||||||||||

See Type for what an algebraic type is.
Should only be applied to types, as opposed to e.g. partially
saturated type constructors. Closed type constructors are those
with a fixed right hand side, as opposed to e.g. associated types
| |||||||||||||||||||||||

isPrimitiveType :: Type -> Bool | |||||||||||||||||||||||

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 | |||||||||||||||||||||||

isStrictType :: Type -> Bool | |||||||||||||||||||||||

Computes whether an argument (or let right hand side) should
be computed strictly or lazily, based only on its type.
Works just like isUnLiftedType, except that it has a special case
for dictionaries (i.e. does not work purely on representation types)
| |||||||||||||||||||||||

isStrictPred :: PredType -> Bool | |||||||||||||||||||||||

We may be strict in dictionary types, but only if it has more than one component. (Being strict in a single-component dictionary risks poking the dictionary component, which is wrong.) | |||||||||||||||||||||||

Main data types representing Kinds | |||||||||||||||||||||||

There's a little subtyping at the kind level: ? / \ / \ ?? (#) / \ * # . Where: * [LiftedTypeKind] means boxed type # [UnliftedTypeKind] means unboxed type (#) [UbxTupleKind] means unboxed tuple ?? [ArgTypeKind] is the lub of {*, #} ? [OpenTypeKind] means any type at all In particular: error :: forall a:?. String -> a (->) :: ?? -> ? -> \* (\\(x::t) -> ...) Where in the last example | |||||||||||||||||||||||

type Kind = Type | |||||||||||||||||||||||

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) | |||||||||||||||||||||||

type SimpleKind = Kind | |||||||||||||||||||||||

type KindVar = TyVar | |||||||||||||||||||||||

Deconstructing Kinds | |||||||||||||||||||||||

kindFunResult :: Kind -> Kind | |||||||||||||||||||||||

Essentially funResultTy on kinds
| |||||||||||||||||||||||

splitKindFunTys :: Kind -> ([Kind], Kind) | |||||||||||||||||||||||

Essentially splitFunTys on kinds
| |||||||||||||||||||||||

splitKindFunTysN :: Int -> Kind -> ([Kind], Kind) | |||||||||||||||||||||||

Essentially splitFunTysN on kinds
| |||||||||||||||||||||||

Common Kinds and SuperKinds | |||||||||||||||||||||||

liftedTypeKind :: Kind | |||||||||||||||||||||||

unliftedTypeKind :: Kind | |||||||||||||||||||||||

See Type for details of the distinction between these Kinds
| |||||||||||||||||||||||

openTypeKind :: Kind | |||||||||||||||||||||||

argTypeKind :: Kind | |||||||||||||||||||||||

ubxTupleKind :: Kind | |||||||||||||||||||||||

tySuperKind :: SuperKind | |||||||||||||||||||||||

coSuperKind :: SuperKind | |||||||||||||||||||||||

Common Kind type constructors | |||||||||||||||||||||||

liftedTypeKindTyCon :: TyCon | |||||||||||||||||||||||

openTypeKindTyCon :: TyCon | |||||||||||||||||||||||

unliftedTypeKindTyCon :: TyCon | |||||||||||||||||||||||

argTypeKindTyCon :: TyCon | |||||||||||||||||||||||

ubxTupleKindTyCon :: TyCon | |||||||||||||||||||||||

Predicates on Kinds | |||||||||||||||||||||||

isLiftedTypeKind :: Kind -> Bool | |||||||||||||||||||||||

isUnliftedTypeKind :: Kind -> Bool | |||||||||||||||||||||||

isOpenTypeKind :: Kind -> Bool | |||||||||||||||||||||||

See Type for details of the distinction between these Kinds
| |||||||||||||||||||||||

isUbxTupleKind :: Kind -> Bool | |||||||||||||||||||||||

isArgTypeKind :: Kind -> Bool | |||||||||||||||||||||||

isKind :: Kind -> Bool | |||||||||||||||||||||||

Is this a kind (i.e. a type-of-types)? | |||||||||||||||||||||||

isTySuperKind :: SuperKind -> Bool | |||||||||||||||||||||||

isCoSuperKind :: SuperKind -> Bool | |||||||||||||||||||||||

isSuperKind :: Type -> Bool | |||||||||||||||||||||||

Is this a super-kind (i.e. a type-of-kinds)? | |||||||||||||||||||||||

isCoercionKind :: Kind -> Bool | |||||||||||||||||||||||

isEqPred :: PredType -> Bool | |||||||||||||||||||||||

mkArrowKind :: Kind -> Kind -> Kind | |||||||||||||||||||||||

Given two kinds k1 and k2, creates the Kind k1 -> k2
| |||||||||||||||||||||||

mkArrowKinds :: [Kind] -> Kind -> Kind | |||||||||||||||||||||||

Iterated application of mkArrowKind
| |||||||||||||||||||||||

isSubArgTypeKind :: Kind -> Bool | |||||||||||||||||||||||

True of any sub-kind of ArgTypeKind | |||||||||||||||||||||||

isSubOpenTypeKind :: Kind -> Bool | |||||||||||||||||||||||

True of any sub-kind of OpenTypeKind (i.e. anything except arrow) | |||||||||||||||||||||||

isSubKind :: Kind -> Kind -> Bool | |||||||||||||||||||||||

k1 `isSubKind` k2 checks that k1 <: k2
| |||||||||||||||||||||||

defaultKind :: Kind -> Kind | |||||||||||||||||||||||

Used when generalising: default kind ? and ?? to *. See Type for more information on what that means | |||||||||||||||||||||||

eqKind :: Kind -> Kind -> Bool | |||||||||||||||||||||||

isSubKindCon :: TyCon -> TyCon -> Bool | |||||||||||||||||||||||

kc1 `isSubKindCon` kc2 checks that kc1 <: kc2
| |||||||||||||||||||||||

Type free variables | |||||||||||||||||||||||

tyVarsOfType :: Type -> TyVarSet | |||||||||||||||||||||||

NB: for type synonyms tyVarsOfType does not expand the synonym
| |||||||||||||||||||||||

tyVarsOfTypes :: [Type] -> TyVarSet | |||||||||||||||||||||||

tyVarsOfPred :: PredType -> TyVarSet | |||||||||||||||||||||||

tyVarsOfTheta :: ThetaType -> TyVarSet | |||||||||||||||||||||||

typeKind :: Type -> Kind | |||||||||||||||||||||||

Tidying type related things up for printing | |||||||||||||||||||||||

tidyType :: TidyEnv -> Type -> Type | |||||||||||||||||||||||

tidyTypes :: TidyEnv -> [Type] -> [Type] | |||||||||||||||||||||||

tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type) | |||||||||||||||||||||||

Grabs the free type variables, tidies them
and then uses tidyType to work over the type itself
| |||||||||||||||||||||||

tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type]) | |||||||||||||||||||||||

tidyTyVarBndr :: TidyEnv -> TyVar -> (TidyEnv, TyVar) | |||||||||||||||||||||||

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. | |||||||||||||||||||||||

tidyFreeTyVars :: TidyEnv -> TyVarSet -> TidyEnv | |||||||||||||||||||||||

Add the free TyVars to the env in tidy form,
so that we can tidy the type they are free in
| |||||||||||||||||||||||

tidyOpenTyVar :: TidyEnv -> TyVar -> (TidyEnv, TyVar) | |||||||||||||||||||||||

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]) | |||||||||||||||||||||||

tidyTopType :: Type -> Type | |||||||||||||||||||||||

Calls tidyType on a top-level type (i.e. with an empty tidying environment)
| |||||||||||||||||||||||

tidyPred :: TidyEnv -> PredType -> PredType | |||||||||||||||||||||||

tidyKind :: TidyEnv -> Kind -> (TidyEnv, Kind) | |||||||||||||||||||||||

Type comparison | |||||||||||||||||||||||

coreEqType :: Type -> Type -> Bool | |||||||||||||||||||||||

Type equality test for Core types (i.e. ignores predicate-types, synonyms etc.) | |||||||||||||||||||||||

tcEqType :: Type -> Type -> Bool | |||||||||||||||||||||||

Type equality on source types. Does not look through newtypes or
PredTypes, but it does look through type synonyms.
| |||||||||||||||||||||||

tcEqTypes :: [Type] -> [Type] -> Bool | |||||||||||||||||||||||

tcCmpType :: Type -> Type -> Ordering | |||||||||||||||||||||||

Type ordering on source types. Does not look through newtypes or
PredTypes, but it does look through type synonyms.
| |||||||||||||||||||||||

tcCmpTypes :: [Type] -> [Type] -> Ordering | |||||||||||||||||||||||

tcEqPred :: PredType -> PredType -> Bool | |||||||||||||||||||||||

tcEqPredX :: RnEnv2 -> PredType -> PredType -> Bool | |||||||||||||||||||||||

tcCmpPred :: PredType -> PredType -> Ordering | |||||||||||||||||||||||

tcEqTypeX :: RnEnv2 -> Type -> Type -> Bool | |||||||||||||||||||||||

tcPartOfType :: Type -> Type -> Bool | |||||||||||||||||||||||

Checks whether the second argument is a subterm of the first. (We don't care about binders, as we are only interested in syntactic subterms.) | |||||||||||||||||||||||

tcPartOfPred :: Type -> PredType -> Bool | |||||||||||||||||||||||

Forcing evaluation of types | |||||||||||||||||||||||

seqType :: Type -> () | |||||||||||||||||||||||

seqTypes :: [Type] -> () | |||||||||||||||||||||||

Other views onto Types | |||||||||||||||||||||||

coreView :: Type -> Maybe Type | |||||||||||||||||||||||

In Core, we "look through" non-recursive newtypes and PredTypes: this function tries to obtain a different view of the supplied type given this Strips off the In the case of 1) A vanilla 2) The newtype representation (otherwise), meaning the type written in the RHS of the newtype declaration, which may itself be a newtype For example, with: newtype R = MkR S newtype S = MkS T newtype T = MkT (T -> T) expandNewTcApp on: -
`R`gives`Just S`*`S`gives`Just T`*`T`gives`Nothing`(no expansion)
| |||||||||||||||||||||||

tcView :: Type -> Maybe Type | |||||||||||||||||||||||

Similar to coreView, but for the type checker, which just looks through synonyms
| |||||||||||||||||||||||

kindView :: Kind -> Maybe Kind | |||||||||||||||||||||||

Similar to coreView or tcView, but works on Kinds
| |||||||||||||||||||||||

repType :: Type -> Type | |||||||||||||||||||||||

Looks through: 1. For-alls 2. Synonyms 3. Predicates 4. All newtypes, including recursive ones, but not newtype families It's useful in the back end of the compiler. | |||||||||||||||||||||||

Type representation for the code generator | |||||||||||||||||||||||

data PrimRep | |||||||||||||||||||||||

| |||||||||||||||||||||||

typePrimRep :: Type -> PrimRep | |||||||||||||||||||||||

Discovers the primitive representation of a more abstract Type
| |||||||||||||||||||||||

predTypeRep :: PredType -> Type | |||||||||||||||||||||||

Convert a PredType to its representation type. However, it unwraps
only the outermost level; for example, the result might be a newtype application
| |||||||||||||||||||||||

Main type substitution data types | |||||||||||||||||||||||

type TvSubstEnv = TyVarEnv Type | |||||||||||||||||||||||

A substitition of Types for TyVars
| |||||||||||||||||||||||

data TvSubst | |||||||||||||||||||||||

| |||||||||||||||||||||||

Manipulating type substitutions | |||||||||||||||||||||||

emptyTvSubstEnv :: TvSubstEnv | |||||||||||||||||||||||

emptyTvSubst :: TvSubst | |||||||||||||||||||||||

mkTvSubst :: InScopeSet -> TvSubstEnv -> TvSubst | |||||||||||||||||||||||

mkOpenTvSubst :: TvSubstEnv -> TvSubst | |||||||||||||||||||||||

Generates the in-scope set for the TvSubst from the types in the incoming
environment, hence open
| |||||||||||||||||||||||

zipOpenTvSubst :: [TyVar] -> [Type] -> TvSubst | |||||||||||||||||||||||

Generates the in-scope set for the TvSubst from the types in the incoming
environment, hence open
| |||||||||||||||||||||||

zipTopTvSubst :: [TyVar] -> [Type] -> TvSubst | |||||||||||||||||||||||

mkTopTvSubst :: [(TyVar, Type)] -> TvSubst | |||||||||||||||||||||||

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 -> Bool | |||||||||||||||||||||||

getTvSubstEnv :: TvSubst -> TvSubstEnv | |||||||||||||||||||||||

setTvSubstEnv :: TvSubst -> TvSubstEnv -> TvSubst | |||||||||||||||||||||||

getTvInScope :: TvSubst -> InScopeSet | |||||||||||||||||||||||

extendTvInScope :: TvSubst -> [Var] -> TvSubst | |||||||||||||||||||||||

extendTvSubst :: TvSubst -> TyVar -> Type -> TvSubst | |||||||||||||||||||||||

extendTvSubstList :: TvSubst -> [TyVar] -> [Type] -> TvSubst | |||||||||||||||||||||||

isInScope :: Var -> TvSubst -> Bool | |||||||||||||||||||||||

composeTvSubst :: InScopeSet -> TvSubstEnv -> TvSubstEnv -> TvSubstEnv | |||||||||||||||||||||||

(compose env1 env2)(x) is env1(env2(x)); i.e. apply env2 then env1.
It assumes that both are idempotent.
Typically, env1 is the refinement to a base substitution env2
| |||||||||||||||||||||||

zipTyEnv :: [TyVar] -> [Type] -> TvSubstEnv | |||||||||||||||||||||||

isEmptyTvSubst :: TvSubst -> Bool | |||||||||||||||||||||||

Performing substitution on types | |||||||||||||||||||||||

substTy :: TvSubst -> Type -> Type | |||||||||||||||||||||||

Substitute within a Type
| |||||||||||||||||||||||

substTys :: TvSubst -> [Type] -> [Type] | |||||||||||||||||||||||

Substitute within several Types
| |||||||||||||||||||||||

substTyWith :: [TyVar] -> [Type] -> Type -> Type | |||||||||||||||||||||||

Type substitution making use of an TvSubst that
is assumed to be open, see zipOpenTvSubst
| |||||||||||||||||||||||

substTysWith :: [TyVar] -> [Type] -> [Type] -> [Type] | |||||||||||||||||||||||

Type substitution making use of an TvSubst that
is assumed to be open, see zipOpenTvSubst
| |||||||||||||||||||||||

substTheta :: TvSubst -> ThetaType -> ThetaType | |||||||||||||||||||||||

Substitute within a ThetaType
| |||||||||||||||||||||||

substPred :: TvSubst -> PredType -> PredType | |||||||||||||||||||||||

Substitute within a PredType
| |||||||||||||||||||||||

substTyVar :: TvSubst -> TyVar -> Type | |||||||||||||||||||||||

substTyVars :: TvSubst -> [TyVar] -> [Type] | |||||||||||||||||||||||

substTyVarBndr :: TvSubst -> TyVar -> (TvSubst, TyVar) | |||||||||||||||||||||||

deShadowTy :: TyVarSet -> Type -> Type | |||||||||||||||||||||||

Remove any nested binders mentioning the TyVars in the TyVarSet
| |||||||||||||||||||||||

lookupTyVar :: TvSubst -> TyVar -> Maybe Type | |||||||||||||||||||||||

Pretty-printing | |||||||||||||||||||||||

pprType :: Type -> SDoc | |||||||||||||||||||||||

pprParendType :: Type -> SDoc | |||||||||||||||||||||||

pprTypeApp :: NamedThing a => a -> [Type] -> SDoc | |||||||||||||||||||||||

pprTyThingCategory :: TyThing -> SDoc | |||||||||||||||||||||||

pprTyThing :: TyThing -> SDoc | |||||||||||||||||||||||

pprForAll :: [TyVar] -> SDoc | |||||||||||||||||||||||

pprPred :: PredType -> SDoc | |||||||||||||||||||||||

pprTheta :: ThetaType -> SDoc | |||||||||||||||||||||||

pprThetaArrow :: ThetaType -> SDoc | |||||||||||||||||||||||

pprClassPred :: Class -> [Type] -> SDoc | |||||||||||||||||||||||

pprKind :: Kind -> SDoc | |||||||||||||||||||||||

pprParendKind :: Kind -> SDoc | |||||||||||||||||||||||

pprSourceTyCon :: TyCon -> SDoc | |||||||||||||||||||||||

Pretty prints a data T [a] = ... In that case we want to print | |||||||||||||||||||||||

Produced by Haddock version 2.4.2 |