ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.TyCl.Utils

Contents

- Implicits
- Record selectors

Description

Analysis functions over data types. Specifically, detecting recursive types.

This stuff is only used for source-code decls; it's recorded in interface files for imported data types.

Synopsis

- type RolesInfo = Name -> [Role]
- inferRoles :: HscSource -> RoleAnnotEnv -> [TyCon] -> Name -> [Role]
- checkSynCycles :: Unit -> [TyCon] -> [LTyClDecl GhcRn] -> TcM ()
- checkClassCycles :: Class -> Maybe SuperclassCycle
- addTyConsToGblEnv :: [TyCon] -> TcM (TcGblEnv, ThBindEnv)
- mkDefaultMethodType :: Class -> Id -> DefMethSpec Type -> Type
- tcRecSelBinds :: [(Id, LHsBind GhcRn)] -> TcM TcGblEnv
- mkRecSelBinds :: [TyCon] -> [(Id, LHsBind GhcRn)]
- mkOneRecordSelector :: [ConLike] -> RecSelParent -> FieldLabel -> FieldSelectors -> (Id, LHsBind GhcRn)

# Documentation

type RolesInfo = Name -> [Role] Source #

inferRoles :: HscSource -> RoleAnnotEnv -> [TyCon] -> Name -> [Role] Source #

checkSynCycles :: Unit -> [TyCon] -> [LTyClDecl GhcRn] -> TcM () Source #

Checks if any of the passed in `TyCon`s have cycles. Takes the `Unit` of the home package (as we can avoid checking those TyCons: cycles never go through foreign packages) and the corresponding `LTyClDecl Name` for each `TyCon`, so we can give better error messages.

checkClassCycles :: Class -> Maybe SuperclassCycle Source #

# Implicits

addTyConsToGblEnv :: [TyCon] -> TcM (TcGblEnv, ThBindEnv) Source #

mkDefaultMethodType :: Class -> Id -> DefMethSpec Type -> Type Source #

# Record selectors

tcRecSelBinds :: [(Id, LHsBind GhcRn)] -> TcM TcGblEnv Source #

mkRecSelBinds :: [TyCon] -> [(Id, LHsBind GhcRn)] Source #

mkOneRecordSelector :: [ConLike] -> RecSelParent -> FieldLabel -> FieldSelectors -> (Id, LHsBind GhcRn) Source #