ghc-9.8.0.20230919: The GHC API
Safe HaskellNone
LanguageHaskell2010

GHC.Types.TyThing

Description

A global typecheckable-thing, essentially anything that has a name.

Synopsis

Documentation

data TyThing Source #

A global typecheckable-thing, essentially anything that has a name. Not to be confused with a TcTyThing, which is also a typecheckable thing but in the *local* context. See GHC.Tc.Utils.Env for how to retrieve a TyThing given a Name.

Instances

Instances details
NamedThing TyThing Source # 
Instance details

Defined in GHC.Types.TyThing

Outputable TyThing Source # 
Instance details

Defined in GHC.Types.TyThing

Methods

ppr :: TyThing -> SDoc Source #

class Monad m => MonadThings (m :: Type -> Type) where Source #

Class that abstracts out the common ability of the monads in GHC to lookup a TyThing in the monadic environment by Name. Provides a number of related convenience functions for accessing particular kinds of TyThing

Minimal complete definition

lookupThing

Instances

Instances details
MonadThings CoreM Source # 
Instance details

Defined in GHC.Plugins

MonadThings TcS Source # 
Instance details

Defined in GHC.Tc.Solver.Monad

MonadThings (IOEnv (Env DsGblEnv DsLclEnv)) Source # 
Instance details

Defined in GHC.HsToCore.Monad

MonadThings (IOEnv (Env TcGblEnv TcLclEnv)) Source # 
Instance details

Defined in GHC.Tc.Utils.Env

MonadThings m => MonadThings (ReaderT s m) Source # 
Instance details

Defined in GHC.Types.TyThing

implicitTyThings :: TyThing -> [TyThing] Source #

Determine the TyThings brought into scope by another TyThing other than itself. For example, Id's don't have any implicit TyThings as they just bring themselves into scope, but classes bring their dictionary datatype, type constructor and some selector functions into scope, just for a start!

isImplicitTyThing :: TyThing -> Bool Source #

Returns True if there should be no interface-file declaration for this thing on its own: either it is built-in, or it is part of some other declaration, or it is generated implicitly by some other declaration.

tyThingParent_maybe :: TyThing -> Maybe TyThing Source #

tyThingParent_maybe x returns (Just p) when pprTyThingInContext should print a declaration for p (albeit with some "..." in it) when asked to show x It returns the *immediate* parent. So a datacon returns its tycon but the tycon could be the associated type of a class, so it in turn might have a parent.

tyThingLocalGREs :: TyThing -> [GlobalRdrElt] Source #

The GlobalRdrElts that a TyThing should bring into scope. Used to build the GlobalRdrEnv for the InteractiveContext.

tyThingGREInfo :: TyThing -> GREInfo Source #

Obtain information pertinent to the renamer about a particular TyThing.

This extracts out renamer information from typechecker information.

tyThingTyCon :: HasDebugCallStack => TyThing -> TyCon Source #

Get the TyCon from a TyThing if it is a type constructor thing. Panics otherwise

tyThingCoAxiom :: HasDebugCallStack => TyThing -> CoAxiom Branched Source #

Get the CoAxiom from a TyThing if it is a coercion axiom thing. Panics otherwise

tyThingDataCon :: HasDebugCallStack => TyThing -> DataCon Source #

Get the DataCon from a TyThing if it is a data constructor thing. Panics otherwise

tyThingConLike :: HasDebugCallStack => TyThing -> ConLike Source #

Get the ConLike from a TyThing if it is a data constructor thing. Panics otherwise

tyThingId :: HasDebugCallStack => TyThing -> Id Source #

Get the Id from a TyThing if it is a id *or* data constructor thing. Panics otherwise