ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions
Safe HaskellIgnore
LanguageGHC2021

GHC.Types.TyThing

Description

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

Synopsis

Documentation

data TyThing #

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 # 
Instance details

Defined in GHC.Types.TyThing

Outputable TyThing # 
Instance details

Defined in GHC.Types.TyThing

Methods

ppr :: TyThing -> SDoc #

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

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 m => MonadThings (ReaderT s m) # 
Instance details

Defined in GHC.Types.TyThing

implicitTyThings :: TyThing -> [TyThing] #

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 #

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 #

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

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

tyThingGREInfo :: TyThing -> GREInfo #

Obtain information pertinent to the renamer about a particular TyThing.

This extracts out renamer information from typechecker information.

tyThingTyCon :: HasDebugCallStack => TyThing -> TyCon #

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

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

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

tyThingDataCon :: HasDebugCallStack => TyThing -> DataCon #

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

tyThingConLike :: HasDebugCallStack => TyThing -> ConLike #

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

tyThingId :: HasDebugCallStack => TyThing -> Id #

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