ghc-9.14.0.20251128: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Plugins

Description

This module is not used by GHC itself. Rather, it exports all of the functions and types you are likely to need when writing a plugin for GHC. So authors of plugins can probably get away simply with saying "import GHC.Plugins".

Particularly interesting modules for plugin writers include GHC.Core and GHC.Core.Opt.Monad.

Synopsis

Documentation

alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a #

Alter an OccEnv, adding or removing an element at the given key.

delFromOccEnv :: OccEnv a -> OccName -> OccEnv a #

Delete one element from an OccEnv.

delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a #

Delete multiple elements from an OccEnv.

elemOccEnv :: OccName -> OccEnv a -> Bool #

Compute whether there is a value keyed by the given OccName.

emptyOccEnv :: OccEnv a #

The empty OccEnv.

extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a #

Add a single element to an OccEnv.

extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a #

Extend an OccEnv by a list.

OccNames later on in the list override earlier OccNames.

extendOccEnv_Acc #

Arguments

:: (a -> b -> b)

add to existing

-> (a -> b)

new element

-> OccEnv b

old

-> OccName 
-> a

new

-> OccEnv b 

Add a single element to an OccEnv, using a different function whether the OccName already exists or not.

filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a #

Filter out all elements in an OccEnv using a predicate.

forceOccEnv :: (a -> ()) -> OccEnv a -> () #

Force an OccEnv with the provided function.

intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c #

isDataSymOcc :: OccName -> Bool #

Test if the OccName is a data constructor that starts with a symbol (e.g. :, or [])

isDerivedOccName :: OccName -> Bool #

Test for definitions internally generated by GHC. This predicate is used to suppress printing of internal definitions in some debug prints

isSymOcc :: OccName -> Bool #

Test if the OccName is that for any operator (whether it is a data constructor or variable or whatever)

isTermVarOrFieldNameSpace :: NameSpace -> Bool #

Is this a term variable or field name namespace?

isTypeableBindOcc :: OccName -> Bool #

Is an OccName one of a Typeable TyCon or Module binding? This is needed as these bindings are renamed differently. See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.

isValOcc :: OccName -> Bool #

Value OccNamess are those that are either in the variable, field name or data constructor namespaces

lookupFieldsOccEnv :: OccEnv a -> FastString -> [a] #

Look up all the record fields that match with the given FastString in an OccEnv.

lookupOccEnv :: OccEnv a -> OccName -> Maybe a #

Look an element up in an OccEnv.

lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a] #

Lookup an element in an OccEnv, ignoring NameSpaces entirely.

lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a] #

Lookup an element in an OccEnv, looking in the record field namespace for a variable.

mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b #

mapMaybe for b OccEnv.

mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an OccEnv (Functor instance).

minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a #

Remove elements of the first OccEnv that appear in the second OccEnv.

minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a #

Alters (replaces or removes) those elements of the first OccEnv that are mentioned in the second OccEnv.

Same idea as differenceWith.

mkDFunOcc #

Arguments

:: String

Typically the class and type glommed together e.g. OrdMaybe. Only used in debug mode, for extra clarity

-> Bool

Is this a hs-boot instance DFun?

-> OccSet

avoid these Occs

-> OccName

E.g. $f3OrdMaybe

mkInstTyTcOcc #

Arguments

:: String

Family name, e.g. Map

-> OccSet

avoid these Occs

-> OccName
R:Map

Derive a name for the representation type constructor of a data/newtype instance.

mkLocalOcc #

Arguments

:: Unique

Unique to combine with the OccName

-> OccName

Local name, e.g. sat

-> OccName

Nice unique version, e.g. $L23sat

mkOccEnv :: [(OccName, a)] -> OccEnv a #

Create an OccEnv from a list.

OccNames later on in the list override earlier OccNames.

mkOccEnv_C #

Arguments

:: (a -> a -> a)

old -> new -> result

-> [(OccName, a)] 
-> OccEnv a 

Create an OccEnv from a list, combining different values with the same OccName using the combining function.

mkSuperDictSelOcc #

Arguments

:: Int

Index of superclass, e.g. 3

-> OccName

Class, e.g. Ord

-> OccName

Derived Occname, e.g. $p3Ord

nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b #

Fold over an OccEnv. Non-deterministic, unless the folding function is commutative (i.e. a1 f ( a2 f b ) == a2 f ( a1 f b ) for all a1, a2, b).

nonDetOccEnvElts :: OccEnv a -> [a] #

Obtain the elements of an OccEnv.

The resulting order is non-deterministic.

occNameMangledFS :: OccName -> FastString #

Mangle field names to avoid duplicate symbols.

See Note [Mangling OccNames].

parenSymOcc :: OccName -> SDoc -> SDoc #

Wrap parens around an operator

plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a #

Union of two OccEnvs, right-biased.

plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a #

Union of two OccEnvs with a combining function.

pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc #

pprOccName :: IsLine doc => OccName -> doc #

startsWithUnderscore :: OccName -> Bool #

Haskell 98 encourages compilers to suppress warnings about unused names in a pattern if they start with _: this implements that test

strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an OccEnv strictly.

unitOccEnv :: OccName -> a -> OccEnv a #

A singleton OccEnv.

type FastStringEnv a = UniqFM FastString a #

A non-deterministic set of FastStrings. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DFastStringEnv if the set eventually gets converted into a list or folded over in a way where the order changes the generated code.

class HasOccName name where #

Other names in the compiler add additional information to an OccName. This class provides a consistent way to access the underlying OccName.

Methods

occName :: name -> OccName #

Instances

Instances details
HasOccName IfaceClassOp # 
Instance details

Defined in GHC.Iface.Syntax

HasOccName IfaceConDecl # 
Instance details

Defined in GHC.Iface.Syntax

HasOccName IfaceDecl # 
Instance details

Defined in GHC.Iface.Syntax

Methods

occName :: IfaceDecl -> OccName #

HasOccName HoleFitCandidate # 
Instance details

Defined in GHC.Tc.Errors.Hole.FitTypes

HasOccName TcBinder # 
Instance details

Defined in GHC.Tc.Types.BasicTypes

Methods

occName :: TcBinder -> OccName #

HasOccName FieldLabel # 
Instance details

Defined in GHC.Types.FieldLabel

HasOccName Name # 
Instance details

Defined in GHC.Types.Name

Methods

occName :: Name -> OccName #

HasOccName OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

occName :: OccName -> OccName #

HasOccName RdrName # 
Instance details

Defined in GHC.Types.Name.Reader

Methods

occName :: RdrName -> OccName #

HasOccName Var # 
Instance details

Defined in GHC.Types.Var

Methods

occName :: Var -> OccName #

HasOccName (GlobalRdrEltX info) # 
Instance details

Defined in GHC.Types.Name.Reader

Methods

occName :: GlobalRdrEltX info -> OccName #

(HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) # 
Instance details

Defined in GHC.Hs.ImpExp

data OccEnv a #

A map keyed on OccName. See Note [OccEnv].

Instances

Instances details
Functor OccEnv # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

fmap :: (a -> b) -> OccEnv a -> OccEnv b Source #

(<$) :: a -> OccEnv b -> OccEnv a Source #

NFData a => NFData (OccEnv a) # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

rnf :: OccEnv a -> () Source #

Outputable a => Outputable (OccEnv a) # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

ppr :: OccEnv a -> SDoc #

data OccName #

Occurrence Name

In this context that means: "classified (i.e. as a type name, value name, etc) but not qualified and not yet resolved"

Instances

Instances details
NFData OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

rnf :: OccName -> () Source #

HasOccName OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

occName :: OccName -> OccName #

Binary OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Outputable OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

ppr :: OccName -> SDoc #

OutputableBndr OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Eq OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Ord OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Data OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccName -> c OccName Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName Source #

toConstr :: OccName -> Constr Source #

dataTypeOf :: OccName -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) Source #

gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

data OccSet #

isDynLinkName :: Platform -> Module -> Name -> Bool #

Will the Name come from a dynamically linked package?

isUnboxedTupleDataConLikeName :: Name -> Bool #

This matches a datacon as well as its worker and promoted tycon.

isWiredIn :: NamedThing thing => thing -> Bool #

localiseName :: Name -> Name #

Make the Name into an internal name, regardless of what it was to begin with

mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name #

Create a name which definitely originates in the given module

mkFCallName :: Unique -> FastString -> Name #

Make a name for a foreign call

mkInternalName :: Unique -> OccName -> SrcSpan -> Name #

Create a name which is (for now at least) local to the current module and hence does not need a Module to disambiguate it from other Names

mkSystemName :: Unique -> OccName -> Name #

Create a name brought into being by the compiler

mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name #

Create a name which is actually defined by the compiler itself

nameIsExternalOrFrom :: Module -> Name -> Bool #

Returns True if the name is external or from the interactive package See documentation of nameIsLocalOrFrom function

nameIsFromExternalPackage :: HomeUnit -> Name -> Bool #

Returns True if the Name comes from some other package: neither this package nor the interactive package.

nameIsLocalOrFrom :: Module -> Name -> Bool #

Returns True if the name is (a) Internal (b) External but from the specified module (c) External but from the interactive package

The key idea is that False means: the entity is defined in some other module you can find the details (type, fixity, instances) in some interface file those details will be stored in the EPT or HPT

True means: the entity is defined in this module or earlier in the GHCi session you can find details (type, fixity, instances) in the TcGblEnv or TcLclEnv

The isInteractiveModule part is because successive interactions of a GHCi session each give rise to a fresh module (Ghci1, Ghci2, etc), but they all come from the magic interactive package; and all the details are kept in the TcLclEnv, TcGblEnv, NOT in the HPT or EPT. See Note [The interactive package] in GHC.Runtime.Context

nameStableString :: Name -> String #

Get a string representation of a Name that's unique and stable across recompilations. Used for deterministic generation of binds for derived instances. eg. "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String"

pprFullName :: Module -> Name -> SDoc #

Print fully qualified name (with unit-id and module, but no unique)

pprFullNameWithUnique :: Module -> Name -> SDoc #

Print fully qualified name (with unit-id and module, with the unique)

pprName :: IsLine doc => Name -> doc #

pprNameUnqualified :: Name -> SDoc #

Print the string of Name unqualifiedly directly.

pprTickyName :: Module -> Name -> SDoc #

Print a ticky ticky styled name

Module argument is the module to use for internal and system names. When printing the name in a ticky profile, the module name is included even for local things. However, ticky uses the format "x (M)" rather than "M.x". Hence, this function provides a separation from normal styling.

stableNameCmp :: Name -> Name -> Ordering #

Compare Names lexicographically This only works for Names that originate in the source code or have been tidied.

alterOccEnv :: (Maybe a -> Maybe a) -> OccEnv a -> OccName -> OccEnv a #

Alter an OccEnv, adding or removing an element at the given key.

delFromOccEnv :: OccEnv a -> OccName -> OccEnv a #

Delete one element from an OccEnv.

delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a #

Delete multiple elements from an OccEnv.

elemOccEnv :: OccName -> OccEnv a -> Bool #

Compute whether there is a value keyed by the given OccName.

emptyOccEnv :: OccEnv a #

The empty OccEnv.

extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a #

Add a single element to an OccEnv.

extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a #

Extend an OccEnv by a list.

OccNames later on in the list override earlier OccNames.

extendOccEnv_Acc #

Arguments

:: (a -> b -> b)

add to existing

-> (a -> b)

new element

-> OccEnv b

old

-> OccName 
-> a

new

-> OccEnv b 

Add a single element to an OccEnv, using a different function whether the OccName already exists or not.

filterOccEnv :: (a -> Bool) -> OccEnv a -> OccEnv a #

Filter out all elements in an OccEnv using a predicate.

forceOccEnv :: (a -> ()) -> OccEnv a -> () #

Force an OccEnv with the provided function.

intersectOccEnv_C :: (a -> b -> c) -> OccEnv a -> OccEnv b -> OccEnv c #

isDataSymOcc :: OccName -> Bool #

Test if the OccName is a data constructor that starts with a symbol (e.g. :, or [])

isDerivedOccName :: OccName -> Bool #

Test for definitions internally generated by GHC. This predicate is used to suppress printing of internal definitions in some debug prints

isSymOcc :: OccName -> Bool #

Test if the OccName is that for any operator (whether it is a data constructor or variable or whatever)

isTermVarOrFieldNameSpace :: NameSpace -> Bool #

Is this a term variable or field name namespace?

isTypeableBindOcc :: OccName -> Bool #

Is an OccName one of a Typeable TyCon or Module binding? This is needed as these bindings are renamed differently. See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable.

isValOcc :: OccName -> Bool #

Value OccNamess are those that are either in the variable, field name or data constructor namespaces

lookupFieldsOccEnv :: OccEnv a -> FastString -> [a] #

Look up all the record fields that match with the given FastString in an OccEnv.

lookupOccEnv :: OccEnv a -> OccName -> Maybe a #

Look an element up in an OccEnv.

lookupOccEnv_AllNameSpaces :: OccEnv a -> OccName -> [a] #

Lookup an element in an OccEnv, ignoring NameSpaces entirely.

lookupOccEnv_WithFields :: OccEnv a -> OccName -> [a] #

Lookup an element in an OccEnv, looking in the record field namespace for a variable.

mapMaybeOccEnv :: (a -> Maybe b) -> OccEnv a -> OccEnv b #

mapMaybe for b OccEnv.

mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an OccEnv (Functor instance).

minusOccEnv :: OccEnv a -> OccEnv b -> OccEnv a #

Remove elements of the first OccEnv that appear in the second OccEnv.

minusOccEnv_C :: (a -> b -> Maybe a) -> OccEnv a -> OccEnv b -> OccEnv a #

Alters (replaces or removes) those elements of the first OccEnv that are mentioned in the second OccEnv.

Same idea as differenceWith.

mkDFunOcc #

Arguments

:: String

Typically the class and type glommed together e.g. OrdMaybe. Only used in debug mode, for extra clarity

-> Bool

Is this a hs-boot instance DFun?

-> OccSet

avoid these Occs

-> OccName

E.g. $f3OrdMaybe

mkInstTyTcOcc #

Arguments

:: String

Family name, e.g. Map

-> OccSet

avoid these Occs

-> OccName
R:Map

Derive a name for the representation type constructor of a data/newtype instance.

mkLocalOcc #

Arguments

:: Unique

Unique to combine with the OccName

-> OccName

Local name, e.g. sat

-> OccName

Nice unique version, e.g. $L23sat

mkOccEnv :: [(OccName, a)] -> OccEnv a #

Create an OccEnv from a list.

OccNames later on in the list override earlier OccNames.

mkOccEnv_C #

Arguments

:: (a -> a -> a)

old -> new -> result

-> [(OccName, a)] 
-> OccEnv a 

Create an OccEnv from a list, combining different values with the same OccName using the combining function.

mkSuperDictSelOcc #

Arguments

:: Int

Index of superclass, e.g. 3

-> OccName

Class, e.g. Ord

-> OccName

Derived Occname, e.g. $p3Ord

nonDetFoldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b #

Fold over an OccEnv. Non-deterministic, unless the folding function is commutative (i.e. a1 f ( a2 f b ) == a2 f ( a1 f b ) for all a1, a2, b).

nonDetOccEnvElts :: OccEnv a -> [a] #

Obtain the elements of an OccEnv.

The resulting order is non-deterministic.

occNameMangledFS :: OccName -> FastString #

Mangle field names to avoid duplicate symbols.

See Note [Mangling OccNames].

parenSymOcc :: OccName -> SDoc -> SDoc #

Wrap parens around an operator

plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a #

Union of two OccEnvs, right-biased.

plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a #

Union of two OccEnvs with a combining function.

pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc #

pprOccName :: IsLine doc => OccName -> doc #

startsWithUnderscore :: OccName -> Bool #

Haskell 98 encourages compilers to suppress warnings about unused names in a pattern if they start with _: this implements that test

strictMapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b #

Map over an OccEnv strictly.

unitOccEnv :: OccName -> a -> OccEnv a #

A singleton OccEnv.

type FastStringEnv a = UniqFM FastString a #

A non-deterministic set of FastStrings. See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for explanation why it's not deterministic and why it matters. Use DFastStringEnv if the set eventually gets converted into a list or folded over in a way where the order changes the generated code.

data BuiltInSyntax #

BuiltInSyntax is for things like (:), [] and tuples, which have special syntactic forms. They aren't in scope as such.

Constructors

BuiltInSyntax 
UserSyntax 

data Name #

A unique, unambiguous name for something, containing information about where that thing originated.

Instances

Instances details
NFData Name # 
Instance details

Defined in GHC.Types.Name

Methods

rnf :: Name -> () Source #

NamedThing Name # 
Instance details

Defined in GHC.Types.Name

HasOccName Name # 
Instance details

Defined in GHC.Types.Name

Methods

occName :: Name -> OccName #

Uniquable Name # 
Instance details

Defined in GHC.Types.Name

Methods

getUnique :: Name -> Unique #

Binary NameEntityInfo # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary Name #

Assumes that the Name is a non-binding one. See putIfaceTopBndr and getIfaceTopBndr for serializing binding Names. See UserData for the rationale for this distinction.

Instance details

Defined in GHC.Types.Name

Outputable Name # 
Instance details

Defined in GHC.Types.Name

Methods

ppr :: Name -> SDoc #

OutputableBndr Name # 
Instance details

Defined in GHC.Types.Name

Eq Name #

The same comments as for Name's Ord instance apply.

Instance details

Defined in GHC.Types.Name

Methods

(==) :: Name -> Name -> Bool Source #

(/=) :: Name -> Name -> Bool Source #

Ord Name #

Caution: This instance is implemented via nonDetCmpUnique, which means that the ordering is not stable across deserialization or rebuilds.

See nonDetCmpUnique for further information, and #15240 for a bug caused by improper use of this instance.

Instance details

Defined in GHC.Types.Name

Data Name # 
Instance details

Defined in GHC.Types.Name

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name Source #

toConstr :: Name -> Constr Source #

dataTypeOf :: Name -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) Source #

gmapT :: (forall b. Data b => b -> b) -> Name -> Name Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Name -> m Name Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name Source #

Outputable (WithUserRdr Name) # 
Instance details

Defined in GHC.Types.Name.Reader

Methods

ppr :: WithUserRdr Name -> SDoc #

OutputableBndr (WithUserRdr Name) # 
Instance details

Defined in GHC.Types.Name.Reader

type Anno Name # 
Instance details

Defined in GHC.Hs.Extension

class NamedThing a where #

A class allowing convenient access to the Name of various datatypes

Minimal complete definition

getName

Methods

getOccName :: a -> OccName #

getName :: a -> Name #

Instances

Instances details
NamedThing Class # 
Instance details

Defined in GHC.Core.Class

NamedThing ConLike # 
Instance details

Defined in GHC.Core.ConLike

NamedThing DataCon # 
Instance details

Defined in GHC.Core.DataCon

NamedThing FamInst # 
Instance details

Defined in GHC.Core.FamInstEnv

NamedThing ClsInst # 
Instance details

Defined in GHC.Core.InstEnv

NamedThing PatSyn # 
Instance details

Defined in GHC.Core.PatSyn

NamedThing TyCon # 
Instance details

Defined in GHC.Core.TyCon

NamedThing IfaceClassOp # 
Instance details

Defined in GHC.Iface.Syntax

NamedThing IfaceConDecl # 
Instance details

Defined in GHC.Iface.Syntax

NamedThing IfaceDecl # 
Instance details

Defined in GHC.Iface.Syntax

NamedThing HoleFitCandidate # 
Instance details

Defined in GHC.Tc.Errors.Hole.FitTypes

NamedThing InvalidFamInstQTv # 
Instance details

Defined in GHC.Tc.Errors.Types

NamedThing ConLikeName # 
Instance details

Defined in GHC.Types.GREInfo

NamedThing Name # 
Instance details

Defined in GHC.Types.Name

NamedThing TyThing # 
Instance details

Defined in GHC.Types.TyThing

NamedThing Var # 
Instance details

Defined in GHC.Types.Var

Methods

getOccName :: Var -> OccName #

getName :: Var -> Name #

NamedThing (CoAxiom br) # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Methods

getOccName :: CoAxiom br -> OccName #

getName :: CoAxiom br -> Name #

NamedThing a => NamedThing (WithUserRdr a) # 
Instance details

Defined in GHC.Types.Name.Reader

NamedThing e => NamedThing (Located e) # 
Instance details

Defined in GHC.Types.Name

NamedThing (Located a) => NamedThing (LocatedAn an a) # 
Instance details

Defined in GHC.Parser.Annotation

Methods

getOccName :: LocatedAn an a -> OccName #

getName :: LocatedAn an a -> Name #

NamedThing tv => NamedThing (VarBndr tv flag) # 
Instance details

Defined in GHC.Types.Var

Methods

getOccName :: VarBndr tv flag -> OccName #

getName :: VarBndr tv flag -> Name #

class HasOccName name where #

Other names in the compiler add additional information to an OccName. This class provides a consistent way to access the underlying OccName.

Methods

occName :: name -> OccName #

Instances

Instances details
HasOccName IfaceClassOp # 
Instance details

Defined in GHC.Iface.Syntax

HasOccName IfaceConDecl # 
Instance details

Defined in GHC.Iface.Syntax

HasOccName IfaceDecl # 
Instance details

Defined in GHC.Iface.Syntax

Methods

occName :: IfaceDecl -> OccName #

HasOccName HoleFitCandidate # 
Instance details

Defined in GHC.Tc.Errors.Hole.FitTypes

HasOccName TcBinder # 
Instance details

Defined in GHC.Tc.Types.BasicTypes

Methods

occName :: TcBinder -> OccName #

HasOccName FieldLabel # 
Instance details

Defined in GHC.Types.FieldLabel

HasOccName Name # 
Instance details

Defined in GHC.Types.Name

Methods

occName :: Name -> OccName #

HasOccName OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

occName :: OccName -> OccName #

HasOccName RdrName # 
Instance details

Defined in GHC.Types.Name.Reader

Methods

occName :: RdrName -> OccName #

HasOccName Var # 
Instance details

Defined in GHC.Types.Var

Methods

occName :: Var -> OccName #

HasOccName (GlobalRdrEltX info) # 
Instance details

Defined in GHC.Types.Name.Reader

Methods

occName :: GlobalRdrEltX info -> OccName #

(HasOccName (IdP (GhcPass p)), OutputableBndrId p) => HasOccName (IEWrappedName (GhcPass p)) # 
Instance details

Defined in GHC.Hs.ImpExp

data OccEnv a #

A map keyed on OccName. See Note [OccEnv].

Instances

Instances details
Functor OccEnv # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

fmap :: (a -> b) -> OccEnv a -> OccEnv b Source #

(<$) :: a -> OccEnv b -> OccEnv a Source #

NFData a => NFData (OccEnv a) # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

rnf :: OccEnv a -> () Source #

Outputable a => Outputable (OccEnv a) # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

ppr :: OccEnv a -> SDoc #

data OccName #

Occurrence Name

In this context that means: "classified (i.e. as a type name, value name, etc) but not qualified and not yet resolved"

Instances

Instances details
NFData OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

rnf :: OccName -> () Source #

HasOccName OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

occName :: OccName -> OccName #

Binary OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Outputable OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

ppr :: OccName -> SDoc #

OutputableBndr OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Eq OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Ord OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Data OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OccName -> c OccName Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c OccName Source #

toConstr :: OccName -> Constr Source #

dataTypeOf :: OccName -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c OccName) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OccName) Source #

gmapT :: (forall b. Data b => b -> b) -> OccName -> OccName Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OccName -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OccName -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OccName -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OccName -> m OccName Source #

data OccSet #

alwaysActiveUnfoldingFun :: IdUnfoldingFun #

Returns an unfolding only if (a) not a strong loop breaker and (b) always active

asJoinId :: Id -> JoinArity -> JoinId infixl 1 #

asJoinId_maybe :: Id -> JoinPointHood -> Id infixl 1 #

asNonWorkerLikeId :: Id -> Id #

Remove any cbv marks on arguments from a given Id.

asWorkerLikeId :: Id -> Id #

Turn this id into a WorkerLikeId if possible.

hasNoBinding :: Id -> Bool #

Returns True of an Id which may not have a binding, even though it is defined in this module.

idCafInfo :: Id -> CafInfo infixl 1 #

idDataCon :: Id -> DataCon #

Get from either the worker or the wrapper Id to the DataCon. Currently used only in the desugarer.

INVARIANT: idDataCon (dataConWrapId d) = d: remember, dataConWrapId can return either the wrapper or the worker

idDmdSig :: Id -> DmdSig #

Accesses the Id's dmdSigInfo.

idFunRepArity :: Id -> RepArity #

This function counts all arguments post-unarisation, which includes arguments with no runtime representation -- see Note [Unarisation and arity]

idJoinPointHood :: Var -> JoinPointHood #

Doesn't return strictness marks

idName :: Id -> Name #

idType :: Id -> Kind #

idUnfolding :: IdUnfoldingFun #

Returns the Ids unfolding, but does not expose the unfolding of a strong loop breaker. See unfoldingInfo.

If you really want the unfolding of a strong loopbreaker, call realIdUnfolding.

isDeadEndId :: Var -> Bool #

Returns true if an application to n args diverges or throws an exception See Note [Dead ends] in GHC.Types.Demand.

isImplicitId :: Id -> Bool #

isImplicitId tells whether an Ids info is implied by other declarations, so we don't need to put its signature in an interface file, even if it's mentioned in some other interface unfolding.

isStrictId :: Id -> Bool #

isStrictId says whether either (a) the Id has a strict demand placed on it or (b) definitely has a "strict type", such that it can always be evaluated strictly (i.e an unlifted type) We need to check (b) as well as (a), because when the demand for the given id hasn't been computed yet but id has a strict type, we still want `isStrictId id` to be True. Returns False if the type is levity polymorphic; False is always safe.

isWorkerLikeId :: Id -> Bool #

An Id for which we might require all callers to pass strict arguments properly tagged + evaluated.

See Note [CBV Function Ids]

mkExportedLocalId :: IdDetails -> Name -> Type -> Id #

Create a local Id that is marked as exported. This prevents things attached to it from being removed as dead code. See Note [Exported LocalIds]

mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id #

For an explanation of global vs. local Ids, see GHC.Types.Var.Var

mkLocalCoVar :: HasDebugCallStack => Name -> Type -> CoVar #

Make a local CoVar

mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id #

For an explanation of global vs. local Ids, see GHC.Types.Var

mkLocalIdOrCoVar :: HasDebugCallStack => Name -> Mult -> Type -> Id #

Like mkLocalId, but checks the type to see if it should make a covar

mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id #

Create a system local Id. These are local Ids (see Var) that are created by the compiler out of thin air

mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id #

Like mkSysLocal, but checks to see if we have a covar type

mkTemplateLocal :: Int -> Type -> Id #

Create a template local: a family of system local Ids in bijection with Ints, typically used in unfoldings

mkTemplateLocals :: [Type] -> [Id] #

Create a template local for a series of types

mkTemplateLocalsNum :: Int -> [Type] -> [Id] #

Create a template local for a series of type, but start from a specified template local

mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id #

Create a user local Id. These are local Ids (see GHC.Types.Var) with a name and location that the user might recognize

mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id #

Like mkUserLocal, but checks if we have a coercion type

mkVanillaGlobal :: HasDebugCallStack => Name -> Type -> Id #

Make a global Id without any extra information at all

mkVanillaGlobalWithInfo :: HasDebugCallStack => Name -> Type -> IdInfo -> Id #

Make a global Id with no global information but some generic IdInfo

mkWorkerId :: Unique -> Id -> Type -> Id #

Workers get local names. CoreTidy will externalise these if necessary

realIdUnfolding :: Id -> Unfolding #

Expose the unfolding if there is one, including for loop breakers

recordSelectorTyCon :: Id -> RecSelParent #

If the Id is that for a record selector, extract the sel_tycon. Panic otherwise.

scaleIdBy :: Mult -> Id -> Id #

scaleVarBy :: Mult -> Var -> Var #

Like scaleIdBy, but skips non-Ids. Useful for scaling a mixed list of ids and tyvars.

setIdArity :: Id -> Arity -> Id infixl 1 #

setIdCallArity :: Id -> Arity -> Id infixl 1 #

setIdCbvMarks :: Id -> [CbvMark] -> Id infixl 1 #

If all marks are NotMarkedStrict we just set nothing.

setIdCprSig :: Id -> CprSig -> Id infixl 1 #

setIdDemandInfo :: Id -> Demand -> Id infixl 1 #

setIdDmdSig :: Id -> DmdSig -> Id infixl 1 #

setIdName :: Id -> Name -> Id #

setIdOccInfo :: Id -> OccInfo -> Id infixl 1 #

setIdOneShotInfo :: Id -> OneShotInfo -> Id infixl 1 #

setIdSpecialisation :: Id -> RuleInfo -> Id infixl 1 #

setIdType :: Id -> Type -> Id #

Not only does this set the Id Type, it also evaluates the type to try and reduce space usage

setIdUnfolding :: Id -> Unfolding -> Id infixl 1 #

setInlinePragma :: Id -> InlinePragma -> Id infixl 1 #

transferPolyIdInfo :: Id -> [Var] -> Id -> Id #

whenActiveUnfoldingFun :: (Activation -> Bool) -> IdUnfoldingFun #

Returns an unfolding only if (a) not a strong loop breaker and (b) active in according to is_active

zapIdUnfolding :: Id -> Id #

Similar to trimUnfolding, but also removes evaldness info.

globaliseId :: Id -> Id #

If it's a local, make it global

isExportedId :: Var -> Bool #

isExportedIdVar means "don't throw this away"

isId :: Var -> Bool #

Is this a value-level (i.e., computationally relevant) Identifier? Satisfies isId = not . isTyVar.

setIdMult :: Id -> Mult -> Id #

updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id #

type Id = Var #

Identifier

type InId = Id #

type InVar = Var #

type JoinId = Id #

type OutId = Id #

type OutVar = Var #

data Var #

Variable

Essentially a typed Name, that may also contain some additional information about the Var and its use sites.

Instances

Instances details
NamedThing Var # 
Instance details

Defined in GHC.Types.Var

Methods

getOccName :: Var -> OccName #

getName :: Var -> Name #

HasOccName Var # 
Instance details

Defined in GHC.Types.Var

Methods

occName :: Var -> OccName #

Uniquable Var # 
Instance details

Defined in GHC.Types.Var

Methods

getUnique :: Var -> Unique #

Outputable Var # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: Var -> SDoc #

OutputableBndr Var # 
Instance details

Defined in GHC.Core.Ppr

Eq Var # 
Instance details

Defined in GHC.Types.Var

Methods

(==) :: Var -> Var -> Bool Source #

(/=) :: Var -> Var -> Bool Source #

Ord Var # 
Instance details

Defined in GHC.Types.Var

Methods

compare :: Var -> Var -> Ordering Source #

(<) :: Var -> Var -> Bool Source #

(<=) :: Var -> Var -> Bool Source #

(>) :: Var -> Var -> Bool Source #

(>=) :: Var -> Var -> Bool Source #

max :: Var -> Var -> Var Source #

min :: Var -> Var -> Var Source #

Data Var # 
Instance details

Defined in GHC.Types.Var

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source #

toConstr :: Var -> Constr Source #

dataTypeOf :: Var -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source #

gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

Eq (DeBruijn CoreAlt) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn CoreExpr) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn Var) # 
Instance details

Defined in GHC.Core.Map.Type

OutputableBndr (Id, TagSig) # 
Instance details

Defined in GHC.Stg.EnforceEpt.TagSig

type Anno Id # 
Instance details

Defined in GHC.Hs.Extension

data JoinPointHood #

Instances

Instances details
NFData JoinPointHood # 
Instance details

Defined in GHC.Utils.Outputable

Methods

rnf :: JoinPointHood -> () Source #

Binary JoinPointHood # 
Instance details

Defined in GHC.Utils.Binary

Outputable JoinPointHood # 
Instance details

Defined in GHC.Utils.Outputable

Methods

ppr :: JoinPointHood -> SDoc #

Eq JoinPointHood # 
Instance details

Defined in GHC.Utils.Outputable

module GHC.Core

cloneBndrs :: Subst -> UniqSupply -> [Var] -> (Subst, [Var]) #

cloneBndrsM :: MonadUnique m => Subst -> [Var] -> m (Subst, [Var]) #

cloneIdBndr :: Subst -> UniqSupply -> Id -> (Subst, Id) #

Very similar to substBndr, but it always allocates a new Unique for each variable in its output. It substitutes the IdInfo though. Discards non-Stable unfoldings

cloneIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) #

Applies cloneIdBndr to a number of Ids, accumulating a final substitution from left to right Discards non-Stable unfoldings

cloneRecIdBndrs :: Subst -> UniqSupply -> [Id] -> (Subst, [Id]) #

Clone a mutually recursive group of Ids

cloneRecIdBndrsM :: MonadUnique m => Subst -> [Id] -> m (Subst, [Id]) #

Clone a mutually recursive group of Ids

deShadowBinds :: CoreProgram -> CoreProgram #

De-shadowing the program is sometimes a useful pre-pass. It can be done simply by running over the bindings with an empty substitution, because substitution returns a result that has no-shadowing guaranteed.

(Actually, within a single type there might still be shadowing, because substTy is a no-op for the empty substitution, but that's probably OK.)

Aug 09
This function is not used in GHC at the moment, but seems so short and simple that I'm going to leave it here

delBndrs :: Subst -> [Var] -> Subst #

extendIdSubst :: Subst -> Id -> CoreExpr -> Subst #

Add a substitution for an Id to the Subst: you must ensure that the in-scope set is such that TyCoSubst Note [The substitution invariant] holds after extending the substitution like this

extendIdSubstList :: Subst -> [(Id, CoreExpr)] -> Subst #

Adds multiple Id substitutions to the Subst: see also extendIdSubst

extendSubst :: HasDebugCallStack => Subst -> Var -> CoreArg -> Subst #

Add a substitution appropriate to the thing being substituted (whether an expression, type, or coercion). See also extendIdSubst, extendTvSubst, extendCvSubst

extendSubstList :: Subst -> [(Var, CoreArg)] -> Subst #

Add a substitution as appropriate to each of the terms being substituted (whether expressions, types, or coercions). See also extendSubst.

lookupIdSubst :: HasDebugCallStack => Subst -> Id -> CoreExpr #

Find the substitution for an Id in the Subst The Id should not be a CoVar

mkOpenSubst :: InScopeSet -> [(Var, CoreArg)] -> Subst #

Simultaneously substitute for a bunch of variables No left-right shadowing ie the substitution for (x y. e) a1 a2 so neither x nor y scope over a1 a2

substBind :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind) #

Apply a substitution to an entire CoreBind, additionally returning an updated Subst that should be used by subsequent substitutions.

substBindSC :: HasDebugCallStack => Subst -> CoreBind -> (Subst, CoreBind) #

Apply a substitution to an entire CoreBind, additionally returning an updated Subst that should be used by subsequent substitutions.

substBndr :: Subst -> Var -> (Subst, Var) #

Substitutes a Var for another one according to the Subst given, returning the result and an updated Subst that should be used by subsequent substitutions. IdInfo is preserved by this process, although it is substituted into appropriately.

substBndrs :: Traversable f => Subst -> f Var -> (Subst, f Var) #

Applies substBndr to a number of Vars, accumulating a new Subst left-to-right

substExpr :: HasDebugCallStack => Subst -> CoreExpr -> CoreExpr #

substExpr applies a substitution to an entire CoreExpr. Remember, you may only apply the substitution once: See Note [Substitutions apply only once] in GHC.Core.TyCo.Subst

Do *not* attempt to short-cut in the case of an empty substitution! See Note [Extending the IdSubstEnv]

substIdInfo :: Subst -> Id -> IdInfo -> Maybe IdInfo #

Substitute into some IdInfo with regard to the supplied new Id. Discards unfoldings, unless they are Stable

substRecBndrs :: Traversable f => Subst -> f Id -> (Subst, f Id) #

Substitute in a mutually recursive group of Ids

substRuleInfo :: Subst -> Id -> RuleInfo -> RuleInfo #

Substitutes for the Ids within the RuleInfo given the new function Id

substTickish :: Subst -> CoreTickish -> CoreTickish #

Drop free vars from the breakpoint if they have a non-variable substitution.

substUnfolding :: Subst -> Unfolding -> Unfolding #

Substitutes for the Ids within an unfolding NB: substUnfolding discards any unfolding without without a Stable source. This is usually what we want, but it may be a bit unexpected

substUnfoldingSC :: Subst -> Unfolding -> Unfolding #

Substitutes for the Ids within an unfolding NB: substUnfolding discards any unfolding without without a Stable source. This is usually what we want, but it may be a bit unexpected

extendSubstInScope :: Subst -> Var -> Subst #

Add the Var to the in-scope set

extendSubstInScopeList :: Subst -> [Var] -> Subst #

Add the Vars to the in-scope set: see also extendInScope

extendTvSubst :: Subst -> TyVar -> Type -> Subst #

Add a substitution for a TyVar to the Subst The TyVar *must* be a real TyVar, and not a CoVar You must ensure that the in-scope set is such that Note [The substitution invariant] holds after extending the substitution like this.

extendTvSubstList :: Subst -> [(TyVar, Type)] -> Subst #

Adds multiple TyVar substitutions to the Subst: see also extendTvSubst

substCo :: HasDebugCallStack => Subst -> Coercion -> Coercion #

Substitute within a Coercion The substitution has to satisfy the invariants described in Note [The substitution invariant].

substInScopeSet :: Subst -> InScopeSet #

Find the in-scope set: see Note [The substitution invariant]

substTyUnchecked :: Subst -> Type -> Type #

Substitute within a Type disabling the sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

zapSubst :: Subst -> Subst #

Remove all substitutions that might have been built up while preserving the in-scope set originally called zapSubstEnv

type IdSubstEnv = IdEnv CoreExpr #

A substitution of Exprs for non-coercion Ids

data Subst #

Type & coercion & id substitution

The Subst data type defined in this module contains substitution for tyvar, covar and id. However, operations on IdSubstEnv (mapping from Id to CoreExpr) that require the definition of the Expr data type are defined in GHC.Core.Subst to avoid circular module dependency.

Instances

Instances details
Outputable Subst # 
Instance details

Defined in GHC.Core.TyCo.Subst

Methods

ppr :: Subst -> SDoc #

type TvSubstEnv = TyVarEnv Type #

A substitution of Types for TyVars and Kinds for KindVars

data InScopeSet #

A set of variables that are in scope at some point.

Note that this is a superset of the variables that are currently in scope. See Note [The InScopeSet invariant].

"Secrets of the Glasgow Haskell Compiler inliner" Section 3.2 provides the motivation for this abstraction.

Instances

Instances details
Outputable InScopeSet # 
Instance details

Defined in GHC.Types.Var.Env

Methods

ppr :: InScopeSet -> SDoc #

closeOverKindsDSet :: DTyVarSet -> DTyVarSet #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministic set.

closeOverKindsList :: [TyVar] -> [TyVar] #

Add the kind variables free in the kinds of the tyvars in the given set. Returns a deterministically ordered list.

tyCoFVsOfType :: Type -> FV #

The worker for tyCoFVsOfType and tyCoFVsOfTypeList. The previous implementation used unionVarSet which is O(n+m) and can make the function quadratic. It's exported, so that it can be composed with other functions that compute free variables. See Note [FV naming conventions] in GHC.Utils.FV.

Eta-expanded because that makes it run faster (apparently) See Note [FV eta expansion] in GHC.Utils.FV for explanation.

tyCoVarsOfTypeDSet :: Type -> DTyCoVarSet #

tyCoFVsOfType that returns free variables of a type in a deterministic set. For explanation of why using VarSet is not deterministic see Note [Deterministic FV] in GHC.Utils.FV.

tyConsOfType :: Type -> UniqSet TyCon #

All type constructors occurring in the type; looking through type synonyms, but not newtypes. When it finds a Class, it returns the class TyCon.

foldTyCo :: Monoid a => TyCoFolder env a -> env -> (Type -> a, [Type] -> a, Coercion -> a, [Coercion] -> a) #

mkForAllTy :: ForAllTyBinder -> Type -> Type #

Like mkTyCoForAllTy, but does not check the occurrence of the binder See Note [Unused coercion variable in ForAllTy]

mkForAllTys :: [ForAllTyBinder] -> Type -> Type #

Wraps foralls over the type using the provided TyCoVars from left to right

mkFunTy :: HasDebugCallStack => FunTyFlag -> Mult -> Type -> Type -> Type infixr 3 #

mkInvisForAllTys :: [InvisTVBinder] -> Type -> Type #

Wraps foralls over the type using the provided InvisTVBinders from left to right

mkVisFunTyMany :: HasDebugCallStack => Type -> Type -> Type infixr 3 #

Make nested arrow types | Special, common, case: Arrow type with mult Many

noView :: Type -> Maybe Type #

A view function that looks through nothing.

composeTCvSubst :: Subst -> Subst -> Subst #

Composes two substitutions, applying the second one provided first, like in function composition. This function leaves IdSubstEnv untouched because IdSubstEnv is not used during substitution for types.

extendCvSubst :: Subst -> CoVar -> Coercion -> Subst #

Add a substitution from a CoVar to a Coercion to the Subst: you must ensure that the in-scope set satisfies Note [The substitution invariant] after extending the substitution like this

extendSubstInScope :: Subst -> Var -> Subst #

Add the Var to the in-scope set

extendSubstInScopeList :: Subst -> [Var] -> Subst #

Add the Vars to the in-scope set: see also extendInScope

extendSubstInScopeSet :: Subst -> VarSet -> Subst #

Add the Vars to the in-scope set: see also extendInScope

getSubstRangeTyCoFVs :: Subst -> VarSet #

Returns the free variables of the types in the range of a substitution as a non-deterministic set.

isEmptyTCvSubst :: Subst -> Bool #

Checks whether the tyvar and covar environments are empty. This function should be used over isEmptySubst when substituting for types, because types currently do not contain expressions; we can safely disregard the expression environment when deciding whether to skip a substitution. Using isEmptyTCvSubst gives us a non-trivial performance boost (up to 70% less allocation for T18223)

mkTvSubstPrs :: [(TyVar, Type)] -> Subst #

Generates the in-scope set for the TCvSubst from the types in the incoming environment. No CoVars, please! The InScopeSet is just a thunk so with a bit of luck it'll never be evaluated

substCo :: HasDebugCallStack => Subst -> Coercion -> Coercion #

Substitute within a Coercion The substitution has to satisfy the invariants described in Note [The substitution invariant].

substCoUnchecked :: Subst -> Coercion -> Coercion #

Substitute within a Coercion disabling sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substCoWithUnchecked :: [TyVar] -> [Type] -> Coercion -> Coercion #

Coercion substitution, see zipTvSubst. Disables sanity checks. The problems that the sanity checks in substCo catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substCoUnchecked to substCo and remove this function. Please don't use in new code.

substInScopeSet :: Subst -> InScopeSet #

Find the in-scope set: see Note [The substitution invariant]

substTheta :: HasDebugCallStack => Subst -> ThetaType -> ThetaType #

Substitute within a ThetaType The substitution has to satisfy the invariants described in Note [The substitution invariant].

substThetaUnchecked :: Subst -> ThetaType -> ThetaType #

Substitute within a ThetaType disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substThetaUnchecked to substTheta and remove this function. Please don't use in new code.

substTyAddInScope :: HasDebugCallStack => Subst -> Type -> Type #

Substitute within a Type after adding the free variables of the type to the in-scope set. This is useful for the case when the free variables aren't already in the in-scope set or easily available. See also Note [The substitution invariant].

substTyUnchecked :: Subst -> Type -> Type #

Substitute within a Type disabling the sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTyWith :: HasDebugCallStack => [TyVar] -> [Type] -> Type -> Type #

Type substitution, see zipTvSubst

substTyWithUnchecked :: [TyVar] -> [Type] -> Type -> Type #

Type substitution, see zipTvSubst. Disables sanity checks. The problems that the sanity checks in substTy catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTyUnchecked to substTy and remove this function. Please don't use in new code.

substTys :: HasDebugCallStack => Subst -> [Type] -> [Type] #

Substitute within several Types The substitution has to satisfy the invariants described in Note [The substitution invariant].

substTysUnchecked :: Subst -> [Type] -> [Type] #

Substitute within several Types disabling the sanity checks. The problems that the sanity checks in substTys catch are described in Note [The substitution invariant]. The goal of #11371 is to migrate all the calls of substTysUnchecked to substTys and remove this function. Please don't use in new code.

substTysWith :: HasDebugCallStack => [TyVar] -> [Type] -> [Type] -> [Type] #

Type substitution, see zipTvSubst

zapSubst :: Subst -> Subst #

Remove all substitutions that might have been built up while preserving the in-scope set originally called zapSubstEnv

zipTvSubst :: HasDebugCallStack => [TyVar] -> [Type] -> Subst #

Generates the in-scope set for the Subst from the types in the incoming environment. No CoVars or Ids, please!

zipTyEnv :: HasDebugCallStack => [TyVar] -> [Type] -> TvSubstEnv #

The InScopeSet is just a thunk so with a bit of luck it'll never be evaluated

mkTyConTy :: TyCon -> Type #

(mkTyConTy tc) returns (TyConApp tc []) but arranges to share that TyConApp among all calls See Note [Sharing nullary TyConApps] So it's just an alias for tyConNullaryTy!

pattern ManyTy :: Mult #

pattern OneTy :: Mult #

appTyForAllTyFlags :: Type -> [Type] -> [ForAllTyFlag] #

Given a Type and a list of argument types to which the Type is applied, determine each argument's visibility (Inferred, Specified, or Required).

Most of the time, the arguments will be Required, but not always. Consider f :: forall a. a -> Type. In f Type Bool, the first argument (Type) is Specified and the second argument (Bool) is Required. It is precisely this sort of higher-rank situation in which appTyForAllTyFlags comes in handy, since f Type Bool would be represented in Core using AppTys. (See also #15792).

buildSynTyCon #

Arguments

:: Name 
-> [KnotTied TyConBinder] 
-> Kind

result kind

-> [Role] 
-> KnotTied Type 
-> TyCon 

chooseFunTyFlag :: HasDebugCallStack => Type -> Type -> FunTyFlag #

See GHC.Types.Var Note [FunTyFlag]

coAxNthLHS :: forall (br :: BranchFlag). CoAxiom br -> Int -> Type #

Get the type on the LHS of a coercion induced by a type/data family instance.

coreFullView :: Type -> Type #

Iterates coreView until there is no more to synonym to expand. NB: coreFullView is non-recursive and can be inlined; core_full_view is the recursive one See Note [Inlining coreView].

coreView :: Type -> Maybe Type #

This function strips off the top layer only of a type synonym application (if any) its underlying representation type. Returns Nothing if there is nothing to look through.

This function does not look through type family applications.

By being non-recursive and inlined, this case analysis gets efficiently joined onto the case analysis that the caller is already doing

dropForAlls :: Type -> Type #

Drops all ForAllTys

dropRuntimeRepArgs :: [Type] -> [Type] #

Drops prefix of RuntimeRep constructors in TyConApps. Useful for e.g. dropping 'LiftedRep arguments of unboxed tuple TyCon applications:

dropRuntimeRepArgs [ 'LiftedRep, 'IntRep , String, Int# ] == [String, Int#]

expandSynTyConApp_maybe :: TyCon -> [Type] -> Maybe Type #

expandSynTyConApp_maybe tc tys expands the RHS of type synonym tc instantiated at arguments tys, or returns Nothing if tc is not a synonym.

expandTypeSynonyms :: Type -> Type #

Expand out all type synonyms. Actually, it'd suffice to expand out just the ones that discard type variables (e.g. type Funny a = Int) But we don't know which those are currently, so we just expand all.

expandTypeSynonyms only expands out type synonyms mentioned in the type, not in the kinds of any TyCon or TyVar mentioned in the type.

Keep this synchronized with synonymTyConsOfType

filterOutInferredTypes :: TyCon -> [Type] -> [Type] #

Given a TyCon and a list of argument types, filter out any Inferred arguments.

filterOutInvisibleTypes :: TyCon -> [Type] -> [Type] #

Given a TyCon and a list of argument types, filter out any invisible (i.e., Inferred or Specified) arguments.

funArgTy :: HasDebugCallStack => Type -> Type #

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

Just like piResultTys but for a single argument Try not to iterate piResultTy, because it's inefficient to substitute one variable at a time; instead use 'piResultTys"

funResultTy :: HasDebugCallStack => Type -> Type #

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

funTyConAppTy_maybe :: FunTyFlag -> Type -> Type -> Type -> Maybe (TyCon, [Type]) #

Given the components of a FunTy figure out the corresponding TyConApp.

getCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN) #

If the type is a tyvar, possibly under a cast, returns it, along with the coercion. Thus, the co is :: kind tv ~N kind ty

getLevity :: HasDebugCallStack => Type -> Type #

Extract the Levity of a type. For example, getLevity Int = Lifted, or getLevity (Array# Int) = Unlifted.

Panics if this is not possible. Does not look through type family applications.

getRuntimeArgTys :: Type -> [(Scaled Type, FunTyFlag)] #

Extracts a list of run-time arguments from a function type, looking through newtypes to the right of arrows.

Examples:

   newtype Identity a = I a

   getRuntimeArgTys (Int -> Bool -> Double) == [(Int, FTF_T_T), (Bool, FTF_T_T)]
   getRuntimeArgTys (Identity Int -> Bool -> Double) == [(Identity Int, FTF_T_T), (Bool, FTF_T_T)]
   getRuntimeArgTys (Int -> Identity (Bool -> Identity Double)) == [(Int, FTF_T_T), (Bool, FTF_T_T)]
   getRuntimeArgTys (forall a. Show a => Identity a -> a -> Int -> Bool)
            == [(Show a, FTF_C_T), (Identity a, FTF_T_T),(a, FTF_T_T),(Int, FTF_T_T)]

Note that, in the last case, the returned types might mention an out-of-scope type variable. This function is used only when we really care about the kinds of the returned types, so this is OK.

  • *Warning**: this function can return an infinite list. For example:
  newtype N a = MkN (a -> N a)
  getRuntimeArgTys (N a) == repeat (a, FTF_T_T)

getRuntimeRep :: HasDebugCallStack => Type -> RuntimeRepType #

Extract the RuntimeRep classifier of a type. For instance, getRuntimeRep_maybe Int = LiftedRep. Panics if this is not possible.

getTyVar :: HasDebugCallStack => 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

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

isBoxedRuntimeRep :: RuntimeRepType -> Bool #

See isBoxedRuntimeRep_maybe.

isBoxedType :: Type -> Bool #

See Type for what a boxed type is. Panics on representation-polymorphic types; See mightBeUnliftedType for a more approximate predicate that behaves better in the presence of representation polymorphism.

isCharLitTy :: Type -> Maybe Char #

Is this a char literal? We also look through type synonyms.

isConcreteType :: Type -> Bool #

Tests whether the given type is concrete, i.e. it whether it consists only of concrete type constructors, concrete type variables, and applications.

See Note [Concrete types] in GHC.Tc.Utils.Concrete.

isDataFamilyApp :: Type -> Bool #

Check whether a type is a data family type

isFixedRuntimeRepKind :: HasDebugCallStack => Kind -> Bool #

Checks that a kind of the form Type, Constraint or 'TYPE r is concrete. See isConcreteType.

Precondition: The type has kind `TYPE blah` or `CONSTRAINT blah`

isForAllTy :: Type -> Bool #

Checks whether this is a proper forall (with a named binder)

isForAllTy_co :: Type -> Bool #

Like isForAllTy, but returns True only if it is a covar binder

isForAllTy_invis_ty :: Type -> Bool #

Like isForAllTy, but returns True only if it is an inferred tyvar binder

isForAllTy_ty :: Type -> Bool #

Like isForAllTy, but returns True only if it is a tyvar binder

isFunTy :: Type -> Bool #

Is this a function? Note: `forall {b}. Show b => b -> IO b` will not be considered a function by this function. It would merely be a forall wrapping a function type.

isLevityTy :: Type -> Bool #

Is this the type Levity?

isLevityVar :: TyVar -> Bool #

Is a tyvar of type Levity?

isLiftedRuntimeRep :: RuntimeRepType -> Bool #

Check whether a type of kind RuntimeRep is lifted.

isLiftedRuntimeRep is:

  • True of LiftedRep :: RuntimeRep
  • False of type variables, type family applications, and of other reps such as IntRep :: RuntimeRep.

isLiftedTypeKind :: Kind -> Bool #

Returns True if the argument is (lifted) Type or Constraint See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim

isLinearType :: Type -> Bool #

isLinear t returns True of a if t is a type of (curried) function where at least one argument is linear (or otherwise non-unrestricted). We use this function to check whether it is safe to eta reduce an Id in CorePrep. It is always safe to return True, because True deactivates the optimisation.

isLitTy :: Type -> Maybe TyLit #

Is this a type literal (symbol, numeric, or char)?

isMultiplicityTy :: Type -> Bool #

Is this the type Multiplicity?

isMultiplicityVar :: TyVar -> Bool #

Is a tyvar of type Multiplicity?

isNumLitTy :: Type -> Maybe Integer #

Is this a numeric literal. We also look through type synonyms.

isPiTy :: Type -> Bool #

Is this a function or forall?

isPrimitiveType :: Type -> Bool #

Returns true of types that are opaque to Haskell.

isRuntimeRepKindedTy :: Type -> Bool #

Is this a type of kind RuntimeRep? (e.g. LiftedRep)

isRuntimeRepTy :: Type -> Bool #

Is this the type RuntimeRep?

isRuntimeRepVar :: TyVar -> Bool #

Is a tyvar of type RuntimeRep?

isStrLitTy :: Type -> Maybe FastString #

Is this a symbol literal. We also look through type synonyms.

isStrictType :: HasDebugCallStack => Type -> Bool #

Computes whether an argument (or let right hand side) should be computed strictly or lazily, based only on its type. Currently, it's just isUnliftedType. Panics on representation-polymorphic types.

isTYPEorCONSTRAINT :: Kind -> Bool #

Does this classify a type allowed to have values? Responds True to things like *, TYPE Lifted, TYPE IntRep, TYPE v, Constraint.

True of a kind `TYPE _` or `CONSTRAINT _`

isTerminatingType :: HasDebugCallStack => Type -> Bool #

True = a term of this type cannot be bottom This identifies the types described by Note [NON-BOTTOM-DICTS invariant] in GHC.Core NB: unlifted types are not terminating types! e.g. you can write a term (loop 1)::Int# that diverges.

isTypeLikeKind :: Kind -> Bool #

Is this kind equivalent to TYPE r (for some unknown r)?

This considers Constraint to be distinct from *.

isUnliftedRuntimeRep :: RuntimeRepType -> Bool #

Check whether a type of kind RuntimeRep is unlifted.

  • True of definitely unlifted RuntimeReps such as UnliftedRep, IntRep, FloatRep, ...
  • False of LiftedRep,
  • False for type variables and type family applications.

isUnliftedType :: HasDebugCallStack => Type -> Bool #

Is the given type definitely unlifted? See Type for what an unlifted type is.

Panics on representation-polymorphic types; See mightBeUnliftedType for a more approximate predicate that behaves better in the presence of representation polymorphism.

isUnliftedTypeKind :: Kind -> Bool #

Returns True if the kind classifies unlifted types (like 'Int#') and False otherwise. Note that this returns False for representation-polymorphic kinds, which may be specialized to a kind that classifies unlifted types.

isValidJoinPointType :: JoinArity -> Type -> Bool #

Determine whether a type could be the type of a join point of given total arity, according to the polymorphism rule. A join point cannot be polymorphic in its return type, since given join j a b x y z = e1 in e2, the types of e1 and e2 must be the same, and a and b are not in scope for e2. (See Note [The polymorphism rule of join points] in GHC.Core.) Returns False also if the type simply doesn't have enough arguments.

Note that we need to know how many arguments (type *and* value) the putative join point takes; for instance, if j :: forall a. a -> Int then j could be a binary join point returning an Int, but it could *not* be a unary join point returning a -> Int.

TODO: See Note [Excess polymorphism and join points]

kindBoxedRepLevity_maybe :: Type -> Maybe Levity #

Check whether a kind is of the form `TYPE (BoxedRep Lifted)` or `TYPE (BoxedRep Unlifted)`.

Returns:

  • `Just Lifted` for `TYPE (BoxedRep Lifted)` and Type,
  • `Just Unlifted` for `TYPE (BoxedRep Unlifted)` and UnliftedType,
  • Nothing for anything else, e.g. `TYPE IntRep`, `TYPE (BoxedRep l)`, etc.

kindRep :: HasDebugCallStack => Kind -> RuntimeRepType #

Extract the RuntimeRep classifier of a type from its kind. For example, kindRep * = LiftedRep; Panics if this is not possible. Treats * and Constraint as the same

kindRep_maybe :: HasDebugCallStack => Kind -> Maybe RuntimeRepType #

Given a kind (TYPE rr) or (CONSTRAINT rr), extract its RuntimeRep classifier rr. For example, kindRep_maybe * = Just LiftedRep Returns Nothing if the kind is not of form (TYPE rr)

levityType_maybe :: LevityType -> Maybe Levity #

levityType_maybe takes a Type of kind Levity, and returns its levity May not be possible for a type variable or type family application

linear :: a -> Scaled a #

Scale a payload by One

mapTyCo :: Monad m => TyCoMapper () m -> (Type -> m Type, [Type] -> m [Type], Coercion -> m Coercion, [Coercion] -> m [Coercion]) #

mapTyCoX :: Monad m => TyCoMapper env m -> (env -> Type -> m Type, env -> [Type] -> m [Type], env -> Coercion -> m Coercion, env -> [Coercion] -> m [Coercion]) #

mightBeLiftedType :: Type -> Bool #

Returns:

  • False if the type is guaranteed unlifted or
  • True if it lifted, OR we aren't sure (e.g. in a representation-polymorphic case)

mightBeUnliftedType :: Type -> Bool #

Returns:

  • False if the type is guaranteed lifted or
  • True if it is unlifted, OR we aren't sure (e.g. in a representation-polymorphic case)

mkAppTy :: Type -> Type -> Type #

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

mkAppTys :: Type -> [Type] -> Type #

mkBoxedRepApp_maybe :: LevityType -> Maybe Type #

Given a Levity, apply BoxedRep to it On the fly, rewrite BoxedRep Lifted --> liftedRepTy (a synonym) BoxedRep Unlifted --> unliftedRepTy (ditto) See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

mkCONSTRAINTapp :: RuntimeRepType -> Type #

Just like mkTYPEapp

mkCONSTRAINTapp_maybe :: RuntimeRepType -> Maybe Type #

Just like mkTYPEapp_maybe

mkCastTy :: Type -> Coercion -> Type #

Make a CastTy. The Coercion must be nominal. Checks the Coercion for reflexivity, dropping it if it's reflexive. See Note [Respecting definitional equality] in GHC.Core.TyCo.Rep

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)

mkFunctionType :: HasDebugCallStack => Mult -> Type -> Type -> Type #

This one works out the FunTyFlag from the argument type See GHC.Types.Var Note [FunTyFlag]

mkInfForAllTy :: TyVar -> Type -> Type #

Like mkTyCoInvForAllTy, but tv should be a tyvar

mkInfForAllTys :: [TyVar] -> Type -> Type #

Like mkTyCoInvForAllTys, but tvs should be a list of tyvar

mkScaled :: Mult -> a -> Scaled a #

mkScaledFunctionTys :: [Scaled Type] -> Type -> Type #

Like mkFunctionType, compute the FunTyFlag from the arguments

mkSpecForAllTy :: TyVar -> Type -> Type #

Like mkForAllTy, but assumes the variable is dependent and Specified, a common case

mkSpecForAllTys :: [TyVar] -> Type -> Type #

Like mkForAllTys, but assumes all variables are dependent and Specified, a common case

mkTYPEapp_maybe :: RuntimeRepType -> Maybe Type #

Given a RuntimeRep, applies TYPE to it. On the fly it rewrites TYPE LiftedRep --> liftedTypeKind (a synonym) TYPE UnliftedRep --> unliftedTypeKind (ditto) TYPE ZeroBitRep --> zeroBitTypeKind (ditto) NB: no need to check for TYPE (BoxedRep Lifted), TYPE (BoxedRep Unlifted) because those inner types should already have been rewritten to LiftedRep and UnliftedRep respectively, by mkTyConApp

see Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

mkTupleRepApp_maybe :: Type -> Maybe Type #

Given a `[RuntimeRep]`, apply TupleRep to it On the fly, rewrite TupleRep [] -> zeroBitRepTy (a synonym) See Note [TYPE and CONSTRAINT] in GHC.Builtin.Types.Prim. See Note [Using synonyms to compress types] in GHC.Core.Type

mkTyCoForAllTy :: TyCoVar -> ForAllTyFlag -> Type -> Type #

Make a dependent forall over a TyCoVar

mkTyCoForAllTys :: [ForAllTyBinder] -> Type -> Type #

Make a dependent forall over a TyCoVar

mkTyCoInvForAllTy :: TyCoVar -> Type -> Type #

Make a dependent forall over an Inferred variable

mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type #

Like mkForAllTys, but assumes all variables are dependent and Inferred, a common case

mkTyConApp :: TyCon -> [Type] -> Type #

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

mkTyConBindersPreferAnon #

Arguments

:: [TyVar]

binders

-> TyCoVarSet

free variables of result

-> [TyConBinder] 

Given a list of type-level vars and the free vars of a result kind, makes PiTyBinders, preferring anonymous binders if the variable is, in fact, not dependent. e.g. mkTyConBindersPreferAnon (k:*),(b:k),(c:k) We want (k:*) Named, (b:k) Anon, (c:k) Anon

All non-coercion binders are visible.

mkVisForAllTys :: [TyVar] -> Type -> Type #

Like mkForAllTys, but assumes all variables are dependent and visible

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

Unwrap one layer of newtype on a type constructor and its arguments, using an eta-reduced version of the newtype if possible. This requires tys to have at least newTyConInstArity tycon elements.

partitionInvisibleTypes :: TyCon -> [Type] -> ([Type], [Type]) #

Given a TyCon and a list of argument types, partition the arguments into:

  1. Inferred or Specified (i.e., invisible) arguments and
  2. Required (i.e., visible) arguments

partitionInvisibles :: [(a, ForAllTyFlag)] -> ([a], [a]) #

Given a list of things paired with their visibilities, partition the things into (invisible things, visible things).

piResultTys :: HasDebugCallStack => Type -> [Type] -> Type #

(piResultTys f_ty [ty1, .., tyn]) gives the type of (f ty1 .. tyn) where f :: f_ty piResultTys is interesting because: 1. f_ty may have more for-alls than there are args 2. Less obviously, it may have fewer for-alls For case 2. think of: piResultTys (forall a.a) [forall b.b, Int] This really can happen, but only (I think) in situations involving undefined. For example: undefined :: forall a. a Term: undefined (forall b. b->b) Int This term should have type (Int -> Int), but notice that there are more type args than foralls in undefineds type.

pprUserTypeErrorTy :: ErrorMsgType -> SDoc #

Render a type corresponding to a user type error into a SDoc.

repGetTyVar_maybe :: Type -> Maybe TyVar #

Attempts to obtain the type variable underlying a Type, without any expansion

runtimeRepLevity_maybe :: RuntimeRepType -> Maybe Levity #

Check whether a type (usually of kind RuntimeRep) is lifted, unlifted, or unknown. Returns Nothing if the type isn't of kind RuntimeRep.

`runtimeRepLevity_maybe rr` returns:

  • `Just Lifted` if rr is `LiftedRep :: RuntimeRep`
  • `Just Unlifted` if rr is definitely unlifted, e.g. IntRep
  • Nothing if not known (e.g. it's a type variable or a type family application).

scaledSet :: Scaled a -> b -> Scaled b #

seqType :: Type -> () #

seqTypes :: [Type] -> () #

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

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

splitAppTyNoView_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type) #

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

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!

splitAppTys :: HasDebugCallStack => 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.

splitAppTysNoView :: HasDebugCallStack => Type -> (Type, [Type]) #

Like splitAppTys, but doesn't look through type synonyms

splitForAllCoVar_maybe :: Type -> Maybe (CoVar, Type) #

Like splitForAllTyCoVar_maybe, but only returns Just if it is a covar binder.

splitForAllForAllTyBinder_maybe :: Type -> Maybe (ForAllTyBinder, Type) #

Attempts to take a ForAllTy apart, returning the full ForAllTyBinder

splitForAllForAllTyBinders :: Type -> ([ForAllTyBinder], Type) #

Take a ForAllTy apart, returning the binders and result type

splitForAllInvisTyBinders :: Type -> ([InvisTyBinder], Type) #

Like splitForAllTyCoVars, but only splits ForAllTys with Invisible type variable binders. Furthermore, each returned tyvar is annotated with its Specificity.

splitForAllReqTyBinders :: Type -> ([ReqTyBinder], Type) #

Like splitForAllTyCoVars, but only splits ForAllTys with Required type variable binders. Furthermore, each returned tyvar is annotated with ().

splitForAllTyCoVar :: Type -> (TyCoVar, Type) #

Take a forall type apart, or panics if that is not possible.

splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type) #

Attempts to take a ForAllTy apart, returning the Var

splitForAllTyCoVars :: Type -> ([TyCoVar], Type) #

Take a ForAllTy apart, returning the list of tycovars and the result type. This always succeeds, even if it returns only an empty list. Note that the result type returned may have free variables that were bound by a forall.

splitForAllTyVar_maybe :: Type -> Maybe (TyVar, Type) #

Attempts to take a ForAllTy apart, but only if the binder is a TyVar

splitForAllTyVars :: Type -> ([TyVar], Type) #

Like splitForAllTyCoVars, but split only for tyvars. This always succeeds, even if it returns only an empty list. Note that the result type returned may have free variables that were bound by a forall.

splitFunTy :: Type -> (Mult, Type, Type) #

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

splitFunTy_maybe :: Type -> Maybe (FunTyFlag, Mult, Type, Type) #

Attempts to extract the multiplicity, argument and result types from a type

splitInvisPiTys :: Type -> ([PiTyBinder], Type) #

Like splitPiTys, but returns only *invisible* binders, including constraints. Stops at the first visible binder.

splitInvisPiTysN :: Int -> Type -> ([PiTyBinder], Type) #

Same as splitInvisPiTys, but stop when - you have found n PiTyBinders, - or you run out of invisible binders

splitPiTy :: Type -> (PiTyBinder, Type) #

Takes a forall type apart, or panics

splitPiTy_maybe :: Type -> Maybe (PiTyBinder, Type) #

Attempts to take a forall type apart; works with proper foralls and functions

splitPiTys :: Type -> ([PiTyBinder], Type) #

Split off all PiTyBinders to a type, splitting both proper foralls and functions

splitRuntimeRep_maybe :: RuntimeRepType -> Maybe (TyCon, [Type]) #

(splitRuntimeRep_maybe rr) takes a Type rr :: RuntimeRep, and returns the (TyCon,[Type]) for the RuntimeRep, if possible, where the TyCon is one of the promoted DataCons of RuntimeRep. Remember: the unique on TyCon that is a a promoted DataCon is the same as the unique on the DataCon See Note [Promoted data constructors] in GHC.Core.TyCon May not be possible if rr is a type variable or type family application

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

splitTyConApp_maybe :: HasDebugCallStack => 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

splitVisibleFunTy_maybe :: Type -> Maybe (Type, Type) #

Works on visible function types only (t1 -> t2), and returns t1 and t2, but not the multiplicity

tcIsBoxedTypeKind :: Kind -> Bool #

Is this kind equivalent to TYPE (BoxedRep l) for some l :: Levity?

tcIsLiftedTypeKind :: Kind -> Bool #

Is this kind equivalent to Type i.e. TYPE LiftedRep?

tcSplitAppTyNoView_maybe :: Type -> Maybe (Type, Type) #

Just like splitAppTyNoView_maybe, but does not split (c => t) See Note [Decomposing fat arrow c=>t]

tcSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) #

tcSplitTyConApp_maybe splits a type constructor application into its type constructor and applied types.

Differs from splitTyConApp_maybe in that it does *not* split types headed with (=>), as that's not a TyCon in the type-checker.

Note that this may fail (in funTyConAppTy_maybe) in the case of a FunTy with an argument of unknown kind FunTy (e.g. `FunTy (a :: k) Int`, since the kind of a isn't of the form `TYPE rep`. This isn't usually a problem but may be temporarily the case during canonicalization: see Note [Decomposing FunTy] in GHC.Tc.Solver.Equality and Note [The Purely Kinded Type Invariant (PKTI)] in GHC.Tc.Gen.HsType, Wrinkle around FunTy

Consequently, you may need to zonk your type before using this function.

tyConAppArgs_maybe :: Type -> Maybe [Type] #

The same as snd . splitTyConApp

tyConAppFunCo_maybe :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Maybe Coercion #

Return Just if this TyConAppCo should be represented as a FunCo

tyConAppFunTy_maybe :: HasDebugCallStack => TyCon -> [Type] -> Maybe Type #

Return Just if this TyConApp should be represented as a FunTy

tyConAppNeedsKindSig #

Arguments

:: Bool

Should specified binders count towards injective positions in the kind of the TyCon? (If you're using visible kind applications, then you want True here.

-> TyCon 
-> Int

The number of args the TyCon is applied to.

-> Bool

Does T t_1 ... t_n need a kind signature? (Where n is the number of arguments)

Does a TyCon (that is applied to some number of arguments) need to be ascribed with an explicit kind signature to resolve ambiguity if rendered as a source-syntax type? (See Note [When does a tycon application need an explicit kind signature?] for a full explanation of what this function checks for.)

tyConAppTyConPicky_maybe :: Type -> Maybe TyCon #

Retrieve the tycon heading this type, if there is one. Does not look through synonyms.

tyConAppTyCon_maybe :: Type -> Maybe TyCon #

The same as fst . splitTyConApp We can short-cut the FunTy case

tyConForAllTyFlags :: TyCon -> [Type] -> [ForAllTyFlag] #

Given a TyCon and a list of argument types to which the TyCon is applied, determine each argument's visibility (Inferred, Specified, or Required).

Wrinkle: consider the following scenario:

T :: forall k. k -> k
tyConForAllTyFlags T [forall m. m -> m -> m, S, R, Q]

After substituting, we get

T (forall m. m -> m -> m) :: (forall m. m -> m -> m) -> forall n. n -> n -> n

Thus, the first argument is invisible, S is visible, R is invisible again, and Q is visible.

tymult :: a -> Scaled a #

Scale a payload by Many; used for type arguments in core

typeHasFixedRuntimeRep :: HasDebugCallStack => Type -> Bool #

Returns True if a type has a syntactically fixed runtime rep, as per Note [Fixed RuntimeRep] in GHC.Tc.Utils.Concrete.

This function is equivalent to `isFixedRuntimeRepKind . typeKind` but much faster.

Precondition: The type has kind (TYPE blah)

typeLevity_maybe :: HasDebugCallStack => Type -> Maybe Levity #

Tries to compute the Levity of the given type. Returns either a definite Levity, or Nothing if we aren't sure (e.g. the type is representation-polymorphic).

Panics if the kind does not have the shape TYPE r.

unrestricted :: a -> Scaled a #

Scale a payload by Many

userTypeError_maybe :: Type -> Maybe ErrorMsgType #

Is this type a custom user error? If so, give us the error message.

anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type #

Extract a relevant type, if there is one.

binderFlag :: VarBndr tv argf -> argf #

binderFlags :: [VarBndr tv argf] -> [argf] #

binderVar :: VarBndr tv argf -> tv #

binderVars :: [VarBndr tv argf] -> [tv] #

isAnonPiTyBinder :: PiTyBinder -> Bool #

Does this binder bind a variable that is not erased? Returns True for anonymous binders.

isInvisiblePiTyBinder :: PiTyBinder -> Bool #

Does this binder bind an invisible argument?

isTyVar :: Var -> Bool #

Is this a type-level (i.e., computationally irrelevant, thus erasable) variable? Satisfies isTyVar = not . isId.

isVisiblePiTyBinder :: PiTyBinder -> Bool #

Does this binder bind a visible argument?

mkForAllTyBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis #

Make a named binder

mkForAllTyBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis] #

Make many named binders

mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis #

Make a named binder var should be a type variable

mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis] #

Make many named binders Input vars should be type variables

isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool #

Does this ForAllTyFlag classify an argument that is not written in Haskell?

isVisibleForAllTyFlag :: ForAllTyFlag -> Bool #

Does this ForAllTyFlag classify an argument that is written in Haskell?

type FRRType = Type #

type Kind = Type #

The key type representing kinds in the compiler.

type KindOrType = Type #

The key representation of types within the compiler

type KnotTied (ty :: k) = ty #

A type labeled KnotTied might have knot-tied tycons in it. See Note [Type checking recursive type and class declarations] in GHC.Tc.TyCl

type Mult = Type #

Mult is a type alias for Type.

Mult must contain Type because multiplicity variables are mere type variables (of kind Multiplicity) in Haskell. So the simplest implementation is to make Mult be Type.

Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon) - Many: GHC.Types.Many (= manyDataCon) - Multiplication: GHC.Types.MultMul (= multMulTyCon)

So that Mult feels a bit more structured, we provide pattern synonyms and smart constructors for these.

type PredType = Type #

A type of the form p of constraint kind represents a value whose type is the Haskell predicate p, where a predicate is what occurs before the => in a Haskell type.

We use PredType as documentation to mark those types that we guarantee to have this kind.

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"

type RuntimeRepType = Type #

Type synonym used for types of kind RuntimeRep.

data Scaled a #

A shorthand for data with an attached Mult element (the multiplicity).

Instances

Instances details
Outputable a => Outputable (Scaled a) # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: Scaled a -> SDoc #

Data a => Data (Scaled a) # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scaled a -> c (Scaled a) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Scaled a) Source #

toConstr :: Scaled a -> Constr Source #

dataTypeOf :: Scaled a -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Scaled a)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Scaled a)) Source #

gmapT :: (forall b. Data b => b -> b) -> Scaled a -> Scaled a Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scaled a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scaled a -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Scaled a -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Scaled a -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scaled a -> m (Scaled a) Source #

type ThetaType = [PredType] #

A collection of PredTypes

data TyCoFolder env a #

Constructors

TyCoFolder 

Fields

data Type #

Instances

Instances details
Outputable Type # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: Type -> SDoc #

Data Type # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type Source #

toConstr :: Type -> Constr Source #

dataTypeOf :: Type -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) Source #

gmapT :: (forall b. Data b => b -> b) -> Type -> Type Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type Source #

Eq (DeBruijn Type) # 
Instance details

Defined in GHC.Core.Map.Type

type IdSubstEnv = IdEnv CoreExpr #

A substitution of Exprs for non-coercion Ids

data Subst #

Type & coercion & id substitution

The Subst data type defined in this module contains substitution for tyvar, covar and id. However, operations on IdSubstEnv (mapping from Id to CoreExpr) that require the definition of the Expr data type are defined in GHC.Core.Subst to avoid circular module dependency.

Instances

Instances details
Outputable Subst # 
Instance details

Defined in GHC.Core.TyCo.Subst

Methods

ppr :: Subst -> SDoc #

type TvSubstEnv = TyVarEnv Type #

A substitution of Types for TyVars and Kinds for KindVars

type ErrorMsgType = Type #

A type of kind ErrorMessage (from the TypeError module).

data TyCoMapper env (m :: Type -> Type) #

This describes how a "map" operation over a type/coercion should behave

Constructors

TyCoMapper 

Fields

type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag #

Variable Binder

A ForAllTyBinder is the binder of a ForAllTy It's convenient to define this synonym here rather its natural home in GHC.Core.TyCo.Rep, because it's used in GHC.Core.DataCon.hs-boot See Note [VarBndrs, ForAllTyBinders, TyConBinders, and visibility]

A TyVarBinder is a binder with only TyVar

data FunTyFlag #

The non-dependent version of ForAllTyFlag. See Note [FunTyFlag] Appears here partly so that it's together with its friends ForAllTyFlag and ForallVisFlag, but also because it is used in IfaceType, rather early in the compilation chain

Constructors

FTF_T_T 
FTF_T_C 
FTF_C_T 
FTF_C_C 

Instances

Instances details
NFData FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Methods

rnf :: FunTyFlag -> () Source #

Binary FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Outputable FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: FunTyFlag -> SDoc #

Eq FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Ord FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Data FunTyFlag # 
Instance details

Defined in GHC.Types.Var

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FunTyFlag -> c FunTyFlag Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FunTyFlag Source #

toConstr :: FunTyFlag -> Constr Source #

dataTypeOf :: FunTyFlag -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FunTyFlag) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunTyFlag) Source #

gmapT :: (forall b. Data b => b -> b) -> FunTyFlag -> FunTyFlag Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> FunTyFlag -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FunTyFlag -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

data PiTyBinder #

A PiTyBinder represents an argument to a function. PiTyBinders can be dependent (Named) or nondependent (Anon). They may also be visible or not. See Note [PiTyBinders]

Instances

Instances details
Outputable PiTyBinder # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: PiTyBinder -> SDoc #

Data PiTyBinder # 
Instance details

Defined in GHC.Types.Var

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PiTyBinder -> c PiTyBinder Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PiTyBinder Source #

toConstr :: PiTyBinder -> Constr Source #

dataTypeOf :: PiTyBinder -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PiTyBinder) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PiTyBinder) Source #

gmapT :: (forall b. Data b => b -> b) -> PiTyBinder -> PiTyBinder Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PiTyBinder -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PiTyBinder -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

type TyCoVar = Id #

Type or Coercion Variable

type TyVar = Var #

Type or kind Variable

data Var #

Variable

Essentially a typed Name, that may also contain some additional information about the Var and its use sites.

Instances

Instances details
NamedThing Var # 
Instance details

Defined in GHC.Types.Var

Methods

getOccName :: Var -> OccName #

getName :: Var -> Name #

HasOccName Var # 
Instance details

Defined in GHC.Types.Var

Methods

occName :: Var -> OccName #

Uniquable Var # 
Instance details

Defined in GHC.Types.Var

Methods

getUnique :: Var -> Unique #

Outputable Var # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: Var -> SDoc #

OutputableBndr Var # 
Instance details

Defined in GHC.Core.Ppr

Eq Var # 
Instance details

Defined in GHC.Types.Var

Methods

(==) :: Var -> Var -> Bool Source #

(/=) :: Var -> Var -> Bool Source #

Ord Var # 
Instance details

Defined in GHC.Types.Var

Methods

compare :: Var -> Var -> Ordering Source #

(<) :: Var -> Var -> Bool Source #

(<=) :: Var -> Var -> Bool Source #

(>) :: Var -> Var -> Bool Source #

(>=) :: Var -> Var -> Bool Source #

max :: Var -> Var -> Var Source #

min :: Var -> Var -> Var Source #

Data Var # 
Instance details

Defined in GHC.Types.Var

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source #

toConstr :: Var -> Constr Source #

dataTypeOf :: Var -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source #

gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

Eq (DeBruijn CoreAlt) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn CoreExpr) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn Var) # 
Instance details

Defined in GHC.Core.Map.Type

OutputableBndr (Id, TagSig) # 
Instance details

Defined in GHC.Stg.EnforceEpt.TagSig

type Anno Id # 
Instance details

Defined in GHC.Hs.Extension

data ForAllTyFlag #

ForAllTyFlag

Is something required to appear in source Haskell (Required), permitted by request (Specified) (visible type application), or prohibited entirely from appearing in source Haskell (Inferred)? See Note [VarBndrs, ForAllTyBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep

Bundled Patterns

pattern Inferred :: ForAllTyFlag 
pattern Specified :: ForAllTyFlag 

Instances

Instances details
NFData ForAllTyFlag # 
Instance details

Defined in GHC.Hs.Specificity

Methods

rnf :: ForAllTyFlag -> () Source #

Binary ForAllTyFlag # 
Instance details

Defined in GHC.Hs.Specificity

Outputable ForAllTyFlag # 
Instance details

Defined in GHC.Hs.Specificity

Methods

ppr :: ForAllTyFlag -> SDoc #

Eq ForAllTyFlag # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Ord ForAllTyFlag # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Data ForAllTyFlag # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ForAllTyFlag Source #

toConstr :: ForAllTyFlag -> Constr Source #

dataTypeOf :: ForAllTyFlag -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForAllTyFlag) Source #

gmapT :: (forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> ForAllTyFlag -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

OutputableBndrFlag ForAllTyFlag p # 
Instance details

Defined in GHC.Hs.Type

Outputable tv => Outputable (VarBndr tv ForAllTyFlag) # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: VarBndr tv ForAllTyFlag -> SDoc #

data Specificity #

Whether an Invisible argument may appear in source Haskell.

Constructors

InferredSpec

the argument may not appear in source Haskell, it is only inferred.

SpecifiedSpec

the argument may appear in source Haskell, but isn't required.

Instances

Instances details
NFData Specificity # 
Instance details

Defined in GHC.Hs.Specificity

Methods

rnf :: Specificity -> () Source #

Binary Specificity # 
Instance details

Defined in GHC.Hs.Specificity

Eq Specificity # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Ord Specificity # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Data Specificity # 
Instance details

Defined in Language.Haskell.Syntax.Specificity

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Specificity -> c Specificity Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Specificity Source #

toConstr :: Specificity -> Constr Source #

dataTypeOf :: Specificity -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Specificity) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Specificity) Source #

gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Specificity -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Specificity -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

OutputableBndrFlag Specificity p # 
Instance details

Defined in GHC.Hs.Type

Outputable tv => Outputable (VarBndr tv Specificity) # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: VarBndr tv Specificity -> SDoc #

buildCoercion :: HasDebugCallStack => Type -> Type -> CoercionN #

Assuming that two types are the same, ignoring coercions, find a nominal coercion between the types. This is useful when optimizing transitivity over coercion applications, where splitting two AppCos might yield different kinds. See Note [EtaAppCo] in GHC.Core.Coercion.Opt.

castCoercionKind :: Coercion -> CoercionN -> CoercionN -> Coercion #

Creates a new coercion with both of its types casted by different casts castCoercionKind g h1 h2, where g :: t1 ~r t2, has type (t1 |> h1) ~r (t2 |> h2). h1 and h2 must be nominal. It calls coercionKindRole, so it's quite inefficient (which I stands for) Use castCoercionKind2 instead if t1, t2, and r are known beforehand.

castCoercionKind1 :: Coercion -> Role -> Type -> Type -> CoercionN -> Coercion #

castCoercionKind1 g r t1 t2 h = coercionKind g r t1 t2 h h That is, it's a specialised form of castCoercionKind, where the two kind coercions are identical castCoercionKind1 g r t1 t2 h, where g :: t1 ~r t2, has type (t1 |> h) ~r (t2 |> h). h must be nominal. See Note [castCoercionKind1]

castCoercionKind2 :: Coercion -> Role -> Type -> Type -> CoercionN -> CoercionN -> Coercion #

Creates a new coercion with both of its types casted by different casts castCoercionKind2 g r t1 t2 h1 h2, where g :: t1 ~r t2, has type (t1 |> h1) ~r (t2 |> h2). h1 and h2 must be nominal.

coercionKind :: HasDebugCallStack => Coercion -> Pair Type #

If it is the case that

c :: (t1 ~ t2)

i.e. the kind of c relates t1 and t2, then coercionKind c = Pair t1 t2.

coercionKindRole :: Coercion -> (Pair Type, Role) #

Get a coercion's kind and role.

coercionKinds :: [Coercion] -> Pair [Type] #

Apply coercionKind to multiple Coercions

coercionRole :: Coercion -> Role #

Retrieve the role from a coercion.

composeSteppers :: NormaliseStepper ev -> NormaliseStepper ev -> NormaliseStepper ev #

Try one stepper and then try the next, if the first doesn't make progress. So if it returns NS_Done, it means that both steppers are satisfied

decomposeCo :: Arity -> Coercion -> Infinite Role -> [Coercion] #

This breaks a Coercion with type T A B C ~ T D E F into a list of Coercions of kinds A ~ D, B ~ E and E ~ F. Hence:

decomposeCo 3 c [r1, r2, r3] = [nth r1 0 c, nth r2 1 c, nth r3 2 c]

downgradeRole :: Role -> Role -> Coercion -> Coercion #

Like downgradeRole_maybe, but panics if the change isn't a downgrade. See Note [Role twiddling functions]

eqCoercion :: Coercion -> Coercion -> Bool #

Syntactic equality of coercions

eqCoercionX :: RnEnv2 -> Coercion -> Coercion -> Bool #

Compare two Coercions, with respect to an RnEnv2

extendLiftingContext #

Arguments

:: LiftingContext

original LC

-> TyCoVar

new variable to map...

-> Coercion

...to this lifted version

-> LiftingContext 

Extend a lifting context with a new mapping.

extendLiftingContextAndInScope #

Arguments

:: LiftingContext

Original LC

-> TyCoVar

new variable to map...

-> Coercion

to this coercion

-> LiftingContext 

Extend a lifting context with a new mapping, and extend the in-scope set

extendLiftingContextCvSubst :: LiftingContext -> CoVar -> Coercion -> LiftingContext #

Extend the substitution component of a lifting context with a new binding for a coercion variable. Used during coercion optimisation.

getCoVar_maybe :: Coercion -> Maybe CoVar #

Extract a covar, if possible. This check is dirty. Be ashamed of yourself. (It's dirty because it cares about the structure of a coercion, which is morally reprehensible.)

getNthFun #

Arguments

:: FunSel 
-> a

multiplicity

-> a

argument

-> a

result

-> a

One of the above three

Extract the nth field of a FunCo

hasCoercionHole :: Type -> Bool #

Is there a coercion hole in this type? See wrinkle (DE6) of Note [Defaulting equalities] in GHC.Tc.Solver.Default

instNewTyCon_maybe :: TyCon -> [Type] -> Maybe (Type, Coercion) #

If `instNewTyCon_maybe T ts = Just (rep_ty, co)` then `co :: T ts ~R# rep_ty`

Checks for a newtype, and for being saturated

isGReflCo :: Coercion -> Bool #

Tests if this coercion is obviously a generalized reflexive coercion. Guaranteed to work very quickly.

isGReflCo_maybe :: Coercion -> Maybe (Type, Role) #

Returns the type coerced if this coercion is a generalized reflexive coercion. Guaranteed to work very quickly.

isGReflMCo :: MCoercion -> Bool #

Tests if this MCoercion is obviously generalized reflexive Guaranteed to work very quickly.

isMappedByLC :: TyCoVar -> LiftingContext -> Bool #

Is a var in the domain of a lifting context?

isReflCo :: Coercion -> Bool #

Tests if this coercion is obviously reflexive. Guaranteed to work very quickly. Sometimes a coercion can be reflexive, but not obviously so. c.f. isReflexiveCo

isReflCo_maybe :: Coercion -> Maybe (Type, Role) #

Returns the type coerced if this coercion is reflexive. Guaranteed to work very quickly. Sometimes a coercion can be reflexive, but not obviously so. c.f. isReflexiveCo_maybe

isReflexiveCo :: Coercion -> Bool #

Slowly checks if the coercion is reflexive. Don't call this in a loop, as it walks over the entire coercion.

isReflexiveCo_maybe :: Coercion -> Maybe (Type, Role) #

Extracts the coerced type from a reflexive coercion. This potentially walks over the entire coercion, so avoid doing this in a loop.

lcLookupCoVar :: LiftingContext -> CoVar -> Maybe Coercion #

Lookup a CoVar in the substitution in a LiftingContext

liftCoSubst :: HasDebugCallStack => Role -> LiftingContext -> Type -> Coercion #

liftCoSubst role lc ty produces a coercion (at role role) that coerces between lc_left(ty) and lc_right(ty), where lc_left is a substitution mapping type variables to the left-hand types of the mapped coercions in lc, and similar for lc_right.

liftCoSubstVarBndrUsing #

Arguments

:: (r -> CoercionN)

coercion getter

-> (LiftingContext -> Type -> r)

callback

-> LiftingContext 
-> TyCoVar 
-> (LiftingContext, TyCoVar, r) 

ltRole :: Role -> Role -> Bool #

mkAppCo #

Arguments

:: Coercion

:: t1 ~r t2

-> Coercion

:: s1 ~N s2, where s1 :: k1, s2 :: k2

-> Coercion

:: t1 s1 ~r t2 s2

Apply a Coercion to another Coercion. The second coercion must be Nominal, unless the first is Phantom. If the first is Phantom, then the second can be either Phantom or Nominal.

mkAppCos :: Coercion -> [Coercion] -> Coercion #

Applies multiple Coercions to another Coercion, from left to right. See also mkAppCo.

mkAxInstLHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type #

Return the left-hand type of the axiom, when the axiom is instantiated at the types given.

mkAxInstRHS :: forall (br :: BranchFlag). CoAxiom br -> BranchIndex -> [Type] -> [Coercion] -> Type #

mkCastTyMCo :: Type -> MCoercion -> Type #

Cast a type by an MCoercion

mkCoercionType :: Role -> Type -> Type -> Type #

Makes a coercion type from two types: the types whose equality is proven by the relevant Coercion

mkCoherenceLeftCo :: Role -> Type -> CoercionN -> Coercion -> Coercion #

Given ty :: k1, co :: k1 ~ k2, co2:: ty ~r ty', produces @co' :: (ty |> co) ~r ty' It is not only a utility function, but it saves allocation when co is a GRefl coercion.

mkCoherenceRightCo :: HasDebugCallStack => Role -> Type -> CoercionN -> Coercion -> Coercion #

Given ty :: k1, co :: k1 ~ k2, co2:: ty' ~r ty, produces @co' :: ty' ~r (ty |> co) It is not only a utility function, but it saves allocation when co is a GRefl coercion.

mkForAllCo :: HasDebugCallStack => TyCoVar -> ForAllTyFlag -> ForAllTyFlag -> CoercionN -> Coercion -> Coercion #

Make a Coercion from a tycovar, a kind coercion, and a body coercion.

mkFunCo :: Role -> FunTyFlag -> CoercionN -> Coercion -> Coercion -> Coercion #

Build a function Coercion from two other Coercions. That is, given co1 :: a ~ b and co2 :: x ~ y produce co :: (a -> x) ~ (b -> y) or (a => x) ~ (b => y), depending on the kind of a/b. This (most common) version takes a single FunTyFlag, which is used for both fco_afl and ftf_afr of the FunCo

mkGReflCo :: Role -> Type -> MCoercionN -> Coercion #

Make a generalized reflexive coercion

mkGReflLeftCo :: Role -> Type -> CoercionN -> Coercion #

Given r, ty :: k1, and co :: k1 ~N k2, produces co' :: (ty |> co) ~r ty

mkGReflRightCo :: Role -> Type -> CoercionN -> Coercion #

Given ty :: k1, co :: k1 ~ k2, produces co' :: ty ~r (ty |> co)

mkHoleCo :: CoercionHole -> Coercion #

Make a coercion from a coercion hole

mkHomoForAllCos :: [ForAllTyBinder] -> Coercion -> Coercion #

Make a Coercion quantified over a type/coercion variable; the variable has the same kind and visibility in both sides of the coercion

mkInstCo :: Coercion -> CoercionN -> Coercion #

Instantiates a Coercion. Works for both tyvar and covar

mkKindCo :: Coercion -> Coercion #

Given co :: (a :: k) ~ (b :: k') produce co' :: k ~ k'.

mkNomReflCo :: Type -> Coercion #

Make a nominal reflexive coercion

mkPhantomCo :: Coercion -> Type -> Type -> Coercion #

Make a phantom coercion between two types. The coercion passed in must be a nominal coercion between the kinds of the types.

mkPiCo :: Role -> Var -> Coercion -> Coercion #

Make a forall Coercion, where both types related by the coercion are quantified over the same variable.

mkProofIrrelCo #

Arguments

:: Role

role of the created coercion, "r"

-> CoercionN

:: phi1 ~N phi2

-> Coercion

g1 :: phi1

-> Coercion

g2 :: phi2

-> Coercion

:: g1 ~r g2

Make a "coercion between coercions".

mkReflCo :: Role -> Type -> Coercion #

Make a reflexive coercion

mkRepReflCo :: Type -> Coercion #

Make a representational reflexive coercion

mkRuntimeRepCo :: HasDebugCallStack => Coercion -> Coercion #

Given a coercion `co :: (t1 :: TYPE r1) ~ (t2 :: TYPE r2)` produce a coercion `rep_co :: r1 ~ r2` But actually it is possible that co :: (t1 :: CONSTRAINT r1) ~ (t2 :: CONSTRAINT r2) or co :: (t1 :: TYPE r1) ~ (t2 :: CONSTRAINT r2) or co :: (t1 :: CONSTRAINT r1) ~ (t2 :: TYPE r2) See Note [mkRuntimeRepCo]

mkSymCo :: Coercion -> Coercion #

Create a symmetric version of the given Coercion that asserts equality between the same types but in the other "direction", so a kind of t1 ~ t2 becomes the kind t2 ~ t1.

mkSymMCo :: MCoercion -> MCoercion #

Get the reverse of an MCoercion

mkTransCo :: HasDebugCallStack => Coercion -> Coercion -> Coercion #

mkTransCo creates a new Coercion by composing the two given Coercions transitively: (co1 ; co2)

mkTransMCo :: MCoercion -> MCoercion -> MCoercion #

Compose two MCoercions via transitivity

mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion #

Apply a type constructor to a list of coercions. It is the caller's responsibility to get the roles correct on argument coercions.

mkUnbranchedAxInstLHS :: CoAxiom Unbranched -> [Type] -> [Coercion] -> Type #

Instantiate the left-hand side of an unbranched axiom

mkUnivCo #

Arguments

:: UnivCoProvenance 
-> [Coercion]

Coercions on which this depends

-> Role

role of the built coercion, "r"

-> Type

t1 :: k1

-> Type

t2 :: k2

-> Coercion

:: t1 ~r t2

Make a universal coercion between two arbitrary types.

pprCoAxiom :: forall (br :: BranchFlag). CoAxiom br -> SDoc #

promoteCoercion :: HasDebugCallStack => Coercion -> CoercionN #

like mkKindCo, but aggressively & recursively optimizes to avoid using a KindCo constructor. The output role is nominal.

seqCo :: Coercion -> () #

setNominalRole_maybe :: Role -> Coercion -> Maybe CoercionN #

Converts a coercion to be nominal, if possible. See Note [Role twiddling functions]

splitAppCo_maybe :: Coercion -> Maybe (Coercion, Coercion) #

Attempt to take a coercion application apart.

swapLiftCoEnv :: LiftCoEnv -> LiftCoEnv #

Apply "sym" to all coercions in a LiftCoEnv

topNormaliseNewType_maybe :: Type -> Maybe (Coercion, Type) #

Sometimes we want to look through a newtype and get its associated coercion. This function strips off newtype layers enough to reveal something that isn't a newtype. Specifically, here's the invariant:

topNormaliseNewType_maybe rec_nts ty = Just (co, ty')

then (a) co : ty ~R ty'. (b) ty' is not a newtype.

The function returns Nothing for non-newtypes, or unsaturated applications

This function does *not* look through type families, because it has no access to the type family environment. If you do have that at hand, consider to use topNormaliseType_maybe, which should be a drop-in replacement for topNormaliseNewType_maybe If topNormliseNewType_maybe ty = Just (co, ty'), then co : ty ~R ty'

topNormaliseTypeX :: NormaliseStepper ev -> (ev -> ev -> ev) -> Type -> Maybe (ev, Type) #

A general function for normalising the top-level of a type. It continues to use the provided NormaliseStepper until that function fails, and then this function returns. The roles of the coercions produced by the NormaliseStepper must all be the same, which is the role returned from the call to topNormaliseTypeX.

Typically ev is Coercion.

If topNormaliseTypeX step plus ty = Just (ev, ty') then ty ~ev1~ t1 ~ev2~ t2 ... ~evn~ ty' and ev = ev1 plus ev2 plus ... plus evn If it returns Nothing then no newtype unwrapping could happen

unwrapNewTypeStepper :: NormaliseStepper Coercion #

A NormaliseStepper that unwraps newtypes, careful not to fall into a loop. If it would fall into a loop, it produces NS_Abort.

zapLiftingContext :: LiftingContext -> LiftingContext #

Erase the environments in a lifting context

tyCoVarsOfCoDSet :: Coercion -> DTyCoVarSet #

Get a deterministic set of the vars free in a coercion

substCoWith :: HasDebugCallStack => [TyVar] -> [Type] -> Coercion -> Coercion #

Coercion substitution, see zipTvSubst

substCos :: HasDebugCallStack => Subst -> [Coercion] -> [Coercion] #

Substitute within several Coercions The substitution has to satisfy the invariants described in Note [The substitution invariant].

tidyCo :: TidyEnv -> Coercion -> Coercion #

Tidy a Coercion

See Note [Strictness in tidyType and friends]

pickLR :: LeftOrRight -> (a, a) -> a #

isCoVar :: Var -> Bool #

Is this a coercion variable? Satisfies isId v ==> isCoVar v == not (isNonCoVarId v).

data LiftingContext #

Constructors

LC Subst LiftCoEnv 

Instances

Instances details
Outputable LiftingContext # 
Instance details

Defined in GHC.Core.Coercion

Methods

ppr :: LiftingContext -> SDoc #

data NormaliseStepResult ev #

The result of stepping in a normalisation function. See topNormaliseTypeX.

Constructors

NS_Done

Nothing more to do

NS_Abort

Utter failure. The outer function should fail too.

NS_Step RecTcChecker Type ev

We stepped, yielding new bits; ^ ev is evidence; Usually a co :: old type ~ new type

Instances

Instances details
Functor NormaliseStepResult # 
Instance details

Defined in GHC.Core.Coercion

Outputable ev => Outputable (NormaliseStepResult ev) # 
Instance details

Defined in GHC.Core.Coercion

Methods

ppr :: NormaliseStepResult ev -> SDoc #

type NormaliseStepper ev = RecTcChecker -> TyCon -> [Type] -> NormaliseStepResult ev #

A function to check if we can reduce a type by one step. Used with topNormaliseTypeX.

data CoSel #

Instances

Instances details
NFData CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

rnf :: CoSel -> () Source #

Binary CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Outputable CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: CoSel -> SDoc #

Eq CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

(==) :: CoSel -> CoSel -> Bool Source #

(/=) :: CoSel -> CoSel -> Bool Source #

Ord CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Data CoSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CoSel -> c CoSel Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoSel Source #

toConstr :: CoSel -> Constr Source #

dataTypeOf :: CoSel -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoSel) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoSel) Source #

gmapT :: (forall b. Data b => b -> b) -> CoSel -> CoSel Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoSel -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoSel -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CoSel -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CoSel -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoSel -> m CoSel Source #

data Coercion #

A Coercion is concrete evidence of the equality/convertibility of two types.

Instances

Instances details
Outputable Coercion # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: Coercion -> SDoc #

Data Coercion # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Coercion -> c Coercion Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Coercion Source #

toConstr :: Coercion -> Constr Source #

dataTypeOf :: Coercion -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Coercion) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Coercion) Source #

gmapT :: (forall b. Data b => b -> b) -> Coercion -> Coercion Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Coercion -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Coercion -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Coercion -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Coercion -> m Coercion Source #

Eq (DeBruijn Coercion) # 
Instance details

Defined in GHC.Core.Map.Type

data CoercionHole #

A coercion to be filled in by the type-checker. See Note [Coercion holes]

Constructors

CoercionHole 

Instances

Instances details
Uniquable CoercionHole # 
Instance details

Defined in GHC.Core.TyCo.Rep

Outputable CoercionHole # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: CoercionHole -> SDoc #

Data CoercionHole # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CoercionHole -> c CoercionHole Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CoercionHole Source #

toConstr :: CoercionHole -> Constr Source #

dataTypeOf :: CoercionHole -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CoercionHole) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CoercionHole) Source #

gmapT :: (forall b. Data b => b -> b) -> CoercionHole -> CoercionHole Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CoercionHole -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CoercionHole -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CoercionHole -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CoercionHole -> m CoercionHole Source #

data FunSel #

Constructors

SelMult 
SelArg 
SelRes 

Instances

Instances details
NFData FunSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

rnf :: FunSel -> () Source #

Outputable FunSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: FunSel -> SDoc #

Eq FunSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Ord FunSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Data FunSel # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FunSel -> c FunSel Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FunSel Source #

toConstr :: FunSel -> Constr Source #

dataTypeOf :: FunSel -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FunSel) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunSel) Source #

gmapT :: (forall b. Data b => b -> b) -> FunSel -> FunSel Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunSel -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunSel -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> FunSel -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FunSel -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FunSel -> m FunSel Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FunSel -> m FunSel Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FunSel -> m FunSel Source #

data MCoercion #

A semantically more meaningful type to represent what may or may not be a useful Coercion.

Constructors

MRefl 
MCo Coercion 

Instances

Instances details
Outputable MCoercion # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: MCoercion -> SDoc #

Data MCoercion # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> MCoercion -> c MCoercion Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c MCoercion Source #

toConstr :: MCoercion -> Constr Source #

dataTypeOf :: MCoercion -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c MCoercion) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c MCoercion) Source #

gmapT :: (forall b. Data b => b -> b) -> MCoercion -> MCoercion Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> MCoercion -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> MCoercion -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> MCoercion -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> MCoercion -> m MCoercion Source #

data UnivCoProvenance #

For simplicity, we have just one UnivCo that represents a coercion from some type to some other type, with (in general) no restrictions on the type. The UnivCoProvenance specifies more exactly what the coercion really is and why a program should (or shouldn't!) trust the coercion. It is reasonable to consider each constructor of UnivCoProvenance as a totally independent coercion form; their only commonality is that they don't tell you what types they coercion between. (That info is in the UnivCo constructor of Coercion.

Instances

Instances details
NFData UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

rnf :: UnivCoProvenance -> () Source #

Binary UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Outputable UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

ppr :: UnivCoProvenance -> SDoc #

Eq UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Ord UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Data UnivCoProvenance # 
Instance details

Defined in GHC.Core.TyCo.Rep

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnivCoProvenance -> c UnivCoProvenance Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnivCoProvenance Source #

toConstr :: UnivCoProvenance -> Constr Source #

dataTypeOf :: UnivCoProvenance -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnivCoProvenance) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnivCoProvenance) Source #

gmapT :: (forall b. Data b => b -> b) -> UnivCoProvenance -> UnivCoProvenance Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnivCoProvenance -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> UnivCoProvenance -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UnivCoProvenance -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnivCoProvenance -> m UnivCoProvenance Source #

type CvSubstEnv = CoVarEnv Coercion #

A substitution of Coercions for CoVars

data LeftOrRight #

Constructors

CLeft 
CRight 

Instances

Instances details
NFData LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Methods

rnf :: LeftOrRight -> () Source #

Binary LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Outputable LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Methods

ppr :: LeftOrRight -> SDoc #

Eq LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Ord LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Data LeftOrRight # 
Instance details

Defined in GHC.Types.Basic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LeftOrRight -> c LeftOrRight Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LeftOrRight Source #

toConstr :: LeftOrRight -> Constr Source #

dataTypeOf :: LeftOrRight -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LeftOrRight) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LeftOrRight) Source #

gmapT :: (forall b. Data b => b -> b) -> LeftOrRight -> LeftOrRight Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LeftOrRight -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> LeftOrRight -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LeftOrRight -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LeftOrRight -> m LeftOrRight Source #

type CoVar = Id #

Coercion Variable

type TyCoVar = Id #

Type or Coercion Variable

data Var #

Variable

Essentially a typed Name, that may also contain some additional information about the Var and its use sites.

Instances

Instances details
NamedThing Var # 
Instance details

Defined in GHC.Types.Var

Methods

getOccName :: Var -> OccName #

getName :: Var -> Name #

HasOccName Var # 
Instance details

Defined in GHC.Types.Var

Methods

occName :: Var -> OccName #

Uniquable Var # 
Instance details

Defined in GHC.Types.Var

Methods

getUnique :: Var -> Unique #

Outputable Var # 
Instance details

Defined in GHC.Types.Var

Methods

ppr :: Var -> SDoc #

OutputableBndr Var # 
Instance details

Defined in GHC.Core.Ppr

Eq Var # 
Instance details

Defined in GHC.Types.Var

Methods

(==) :: Var -> Var -> Bool Source #

(/=) :: Var -> Var -> Bool Source #

Ord Var # 
Instance details

Defined in GHC.Types.Var

Methods

compare :: Var -> Var -> Ordering Source #

(<) :: Var -> Var -> Bool Source #

(<=) :: Var -> Var -> Bool Source #

(>) :: Var -> Var -> Bool Source #

(>=) :: Var -> Var -> Bool Source #

max :: Var -> Var -> Var Source #

min :: Var -> Var -> Var Source #

Data Var # 
Instance details

Defined in GHC.Types.Var

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source #

toConstr :: Var -> Constr Source #

dataTypeOf :: Var -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source #

gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

Eq (DeBruijn CoreAlt) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn CoreExpr) # 
Instance details

Defined in GHC.Core.Map.Expr

Eq (DeBruijn Var) # 
Instance details

Defined in GHC.Core.Map.Type

OutputableBndr (Id, TagSig) # 
Instance details

Defined in GHC.Stg.EnforceEpt.TagSig

type Anno Id # 
Instance details

Defined in GHC.Hs.Extension

data Role #

See Note [Roles] in GHC.Core.Coercion

Order of constructors matters: the Ord instance coincides with the *super*typing relation on roles.

Instances

Instances details
NFData Role # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Methods

rnf :: Role -> () Source #

Binary Role # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Outputable Role # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Methods

ppr :: Role -> SDoc #

Eq Role # 
Instance details

Defined in Language.Haskell.Syntax.Basic

Methods

(==) :: Role -> Role -> Bool Source #

(/=) :: Role -> Role -> Bool Source #

Ord Role # 
Instance details

Defined in Language.Haskell.Syntax.Basic

Data Role # 
Instance details

Defined in Language.Haskell.Syntax.Basic

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Role -> c Role Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Role Source #

toConstr :: Role -> Constr Source #

dataTypeOf :: Role -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Role) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Role) Source #

gmapT :: (forall b. Data b => b -> b) -> Role -> Role Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Role -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Role -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Role -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Role -> m Role Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Role -> m Role Source #

type Anno (Maybe Role) # 
Instance details

Defined in GHC.Hs.Decls

class Uniquable a where #

Class of things that we can obtain a Unique from

Methods

getUnique :: a -> Unique #

Instances

Instances details
Uniquable LocalLabel # 
Instance details

Defined in GHC.ByteCode.Instr

Uniquable Label # 
Instance details

Defined in GHC.Cmm.Dataflow.Label

Methods

getUnique :: Label -> Unique #

Uniquable LocalReg # 
Instance details

Defined in GHC.Cmm.Reg

Methods

getUnique :: LocalReg -> Unique #

Uniquable RegWithFormat # 
Instance details

Defined in GHC.CmmToAsm.Format

Uniquable Reg #

so we can put regs in UniqSets

Instance details

Defined in GHC.CmmToAsm.Reg.Graph.Base

Methods

getUnique :: Reg -> Unique #

Uniquable SymName # 
Instance details

Defined in GHC.CmmToAsm.Wasm.Types

Methods

getUnique :: SymName -> Unique #

Uniquable Class # 
Instance details

Defined in GHC.Core.Class

Methods

getUnique :: Class -> Unique #

Uniquable ConLike # 
Instance details

Defined in GHC.Core.ConLike

Methods

getUnique :: ConLike -> Unique #

Uniquable DataCon # 
Instance details

Defined in GHC.Core.DataCon

Methods

getUnique :: DataCon -> Unique #

Uniquable PatSyn # 
Instance details

Defined in GHC.Core.PatSyn

Methods

getUnique :: PatSyn -> Unique #

Uniquable CoercionHole # 
Instance details

Defined in GHC.Core.TyCo.Rep

Uniquable TyCon # 
Instance details

Defined in GHC.Core.TyCon

Methods

getUnique :: TyCon -> Unique #

Uniquable FastString # 
Instance details

Defined in GHC.Types.Unique

Uniquable Ident # 
Instance details

Defined in GHC.JS.Ident

Methods

getUnique :: Ident -> Unique #

Uniquable RealReg # 
Instance details

Defined in GHC.Platform.Reg

Methods

getUnique :: RealReg -> Unique #

Uniquable Reg # 
Instance details

Defined in GHC.Platform.Reg

Methods

getUnique :: Reg -> Unique #

Uniquable VirtualReg # 
Instance details

Defined in GHC.Platform.Reg

Uniquable RegClass # 
Instance details

Defined in GHC.Platform.Reg.Class

Methods

getUnique :: RegClass -> Unique #

Uniquable EvBindsVar # 
Instance details

Defined in GHC.Tc.Types.Evidence

Uniquable SkolemInfo # 
Instance details

Defined in GHC.Tc.Types.Origin

Uniquable ConLikeName # 
Instance details

Defined in GHC.Types.GREInfo

Uniquable Name # 
Instance details

Defined in GHC.Types.Name

Methods

getUnique :: Name -> Unique #

Uniquable NameSpace # 
Instance details

Defined in GHC.Types.Name.Occurrence

Uniquable Unique # 
Instance details

Defined in GHC.Types.Unique

Methods

getUnique :: Unique -> Unique #

Uniquable Var # 
Instance details

Defined in GHC.Types.Var

Methods

getUnique :: Var -> Unique #

Uniquable PackageId # 
Instance details

Defined in GHC.Unit.Info

Uniquable PackageName # 
Instance details

Defined in GHC.Unit.Info

Uniquable WarningCategory # 
Instance details

Defined in GHC.Unit.Module.Warnings

Uniquable Module # 
Instance details

Defined in GHC.Unit.Types

Methods

getUnique :: Module -> Unique #

Uniquable UnitId # 
Instance details

Defined in GHC.Unit.Types

Methods

getUnique :: UnitId -> Unique #

Uniquable FieldLabelString # 
Instance details

Defined in GHC.Types.FieldLabel

Uniquable ModuleName # 
Instance details

Defined in GHC.Types.Unique

Uniquable Word64 # 
Instance details

Defined in GHC.Types.Unique

Methods

getUnique :: Word64 -> Unique #

Uniquable Int # 
Instance details

Defined in GHC.Types.Unique

Methods

getUnique :: Int -> Unique #

Uniquable (CoAxiom br) # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Methods

getUnique :: CoAxiom br -> Unique #

Uniquable unit => Uniquable (Definite unit) # 
Instance details

Defined in GHC.Unit.Types

Methods

getUnique :: Definite unit -> Unique #

IsUnitId u => Uniquable (GenUnit u) # 
Instance details

Defined in GHC.Unit.Types

Methods

getUnique :: GenUnit u -> Unique #

data Unique #

Unique identifier.

The type of unique identifiers that are used in many places in GHC for fast ordering and equality tests. You should generate these with the functions from the UniqSupply module

These are sometimes also referred to as "keys" in comments in GHC.

Instances

Instances details
Uniquable Unique # 
Instance details

Defined in GHC.Types.Unique

Methods

getUnique :: Unique -> Unique #

Outputable Unique # 
Instance details

Defined in GHC.Types.Unique

Methods

ppr :: Unique -> SDoc #

Eq Unique # 
Instance details

Defined in GHC.Types.Unique

Show Unique # 
Instance details

Defined in GHC.Types.Unique

data Messages e #

A collection of messages emitted by GHC during error reporting. A diagnostic message is typically a warning or an error. See Note [Messages].

INVARIANT: All the messages in this collection must be relevant, i.e. their Severity should not be SevIgnore. The smart constructor mkMessages will filter out any message which Severity is SevIgnore.

Instances

Instances details
Functor Messages # 
Instance details

Defined in GHC.Types.Error

Methods

fmap :: (a -> b) -> Messages a -> Messages b Source #

(<$) :: a -> Messages b -> Messages a Source #

Foldable Messages # 
Instance details

Defined in GHC.Types.Error

Methods

fold :: Monoid m => Messages m -> m Source #

foldMap :: Monoid m => (a -> m) -> Messages a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Messages a -> m Source #

foldr :: (a -> b -> b) -> b -> Messages a -> b Source #

foldr' :: (a -> b -> b) -> b -> Messages a -> b Source #

foldl :: (b -> a -> b) -> b -> Messages a -> b Source #

foldl' :: (b -> a -> b) -> b -> Messages a -> b Source #

foldr1 :: (a -> a -> a) -> Messages a -> a Source #

foldl1 :: (a -> a -> a) -> Messages a -> a Source #

toList :: Messages a -> [a] Source #

null :: Messages a -> Bool Source #

length :: Messages a -> Int Source #

elem :: Eq a => a -> Messages a -> Bool Source #

maximum :: Ord a => Messages a -> a Source #

minimum :: Ord a => Messages a -> a Source #

sum :: Num a => Messages a -> a Source #

product :: Num a => Messages a -> a Source #

Traversable Messages # 
Instance details

Defined in GHC.Types.Error

Methods

traverse :: Applicative f => (a -> f b) -> Messages a -> f (Messages b) Source #

sequenceA :: Applicative f => Messages (f a) -> f (Messages a) Source #

mapM :: Monad m => (a -> m b) -> Messages a -> m (Messages b) Source #

sequence :: Monad m => Messages (m a) -> m (Messages a) Source #

Diagnostic e => ToJson (Messages e) # 
Instance details

Defined in GHC.Types.Error

Methods

json :: Messages e -> JsonDoc #

Diagnostic e => Outputable (Messages e) # 
Instance details

Defined in GHC.Types.Error

Methods

ppr :: Messages e -> SDoc #

Monoid (Messages e) # 
Instance details

Defined in GHC.Types.Error

Semigroup (Messages e) # 
Instance details

Defined in GHC.Types.Error

Getting Names

thNameToGhcName :: Name -> CoreM (Maybe Name) #

Attempt to convert a Template Haskell name to one that GHC can understand. Original TH names such as those you get when you use the 'foo syntax will be translated to their equivalent GHC name exactly. Qualified or unqualified TH names will be dynamically bound to names in the module being compiled, if possible. Exact TH names will be bound to the name they represent, exactly.

thNameToGhcNameIO :: NameCache -> Name -> IO (Maybe Name) #

Attempt to convert a Template Haskell name to one that GHC can understand. Original TH names such as those you get when you use the 'foo syntax will be translated to their equivalent GHC name exactly. Qualified or unqualified TH names will be dynamically bound to names in the module being compiled, if possible. Exact TH names will be bound to the name they represent, exactly.

One must be careful to consistently use the same NameCache to create identifier that might be compared. (C.f. how the ST Monad enforces that variables from separate runST invocations are never intermingled; it would be valid to use the same tricks for Names and NameCaches.)

For now, the easiest and recommended way to ensure a consistent NameCache is used it to retrieve the preexisting one from an active HscEnv. A single HscEnv is created per GHC "session", and this ensures everything in that session will get the same name cache.

Orphan instances