ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

IfaceType

Synopsis

- type IfExtName = Name
- type IfLclName = FastString
- data IfaceType
  - = IfaceFreeTyVar TyVar
  - | IfaceTyVar IfLclName
  - | IfaceLitTy IfaceTyLit
  - | IfaceAppTy IfaceType IfaceType
  - | IfaceFunTy IfaceType IfaceType
  - | IfaceDFunTy IfaceType IfaceType
  - | IfaceForAllTy IfaceForAllBndr IfaceType
  - | IfaceTyConApp IfaceTyCon IfaceTcArgs
  - | IfaceCastTy IfaceType IfaceCoercion
  - | IfaceCoercionTy IfaceCoercion
  - | IfaceTupleTy TupleSort IsPromoted IfaceTcArgs
- type IfacePredType = IfaceType
- type IfaceKind = IfaceType
- data IfaceCoercion
  - = IfaceReflCo Role IfaceType
  - | IfaceFunCo Role IfaceCoercion IfaceCoercion
  - | IfaceTyConAppCo Role IfaceTyCon [IfaceCoercion]
  - | IfaceAppCo IfaceCoercion IfaceCoercion
  - | IfaceForAllCo IfaceTvBndr IfaceCoercion IfaceCoercion
  - | IfaceCoVarCo IfLclName
  - | IfaceAxiomInstCo IfExtName BranchIndex [IfaceCoercion]
  - | IfaceUnivCo IfaceUnivCoProv Role IfaceType IfaceType
  - | IfaceSymCo IfaceCoercion
  - | IfaceTransCo IfaceCoercion IfaceCoercion
  - | IfaceNthCo Int IfaceCoercion
  - | IfaceLRCo LeftOrRight IfaceCoercion
  - | IfaceInstCo IfaceCoercion IfaceCoercion
  - | IfaceCoherenceCo IfaceCoercion IfaceCoercion
  - | IfaceKindCo IfaceCoercion
  - | IfaceSubCo IfaceCoercion
  - | IfaceAxiomRuleCo IfLclName [IfaceCoercion]
- data IfaceUnivCoProv
  - = IfaceUnsafeCoerceProv
  - | IfacePhantomProv IfaceCoercion
  - | IfaceProofIrrelProv IfaceCoercion
  - | IfacePluginProv String
  - | IfaceHoleProv Unique
- data IfaceTyCon = IfaceTyCon {
  - ifaceTyConName :: IfExtName
  - ifaceTyConInfo :: IfaceTyConInfo
  }
- data IfaceTyConInfo = IfaceTyConInfo {
  - ifaceTyConIsPromoted :: IsPromoted
  - ifaceTyConSort :: IfaceTyConSort
  }
- data IfaceTyConSort
  - = IfaceNormalTyCon
  - | IfaceTupleTyCon !Arity !TupleSort
  - | IfaceSumTyCon !Arity
  - | IfaceEqualityTyCon !Bool
- data IsPromoted
  - = IsNotPromoted
  - | IsPromoted
- data IfaceTyLit
  - = IfaceNumTyLit Integer
  - | IfaceStrTyLit FastString
- data IfaceTcArgs
  - = ITC_Nil
  - | ITC_Vis IfaceType IfaceTcArgs
  - | ITC_Invis IfaceKind IfaceTcArgs
- type IfaceContext = [IfacePredType]
- data IfaceBndr
  - = IfaceIdBndr !IfaceIdBndr
  - | IfaceTvBndr !IfaceTvBndr
- data IfaceOneShot
  - = IfaceNoOneShot
  - | IfaceOneShot
- type IfaceLamBndr = (IfaceBndr, IfaceOneShot)
- type IfaceTvBndr = (IfLclName, IfaceKind)
- type IfaceIdBndr = (IfLclName, IfaceType)
- type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis
- type IfaceForAllBndr = TyVarBndr IfaceTvBndr ArgFlag
- data ArgFlag
  - = Required
  - | Specified
  - | Inferred
- data ShowForAllFlag
  - = ShowForAllMust
  - | ShowForAllWhen
- ifTyConBinderTyVar :: IfaceTyConBinder -> IfaceTvBndr
- ifTyConBinderName :: IfaceTyConBinder -> IfLclName
- data IfRnEnv2
- emptyIfRnEnv2 :: IfRnEnv2
- eqIfaceType :: IfRnEnv2 -> IfaceType -> IfaceType -> Bool
- eqIfaceTypes :: IfRnEnv2 -> [IfaceType] -> [IfaceType] -> Bool
- eqIfaceTcArgs :: IfRnEnv2 -> IfaceTcArgs -> IfaceTcArgs -> Bool
- eqIfaceTvBndrs :: IfRnEnv2 -> [IfaceTvBndr] -> [IfaceTvBndr] -> Maybe IfRnEnv2
- isIfaceLiftedTypeKind :: IfaceKind -> Bool
- tcArgsIfaceTypes :: IfaceTcArgs -> [IfaceType]
- pprIfaceType :: IfaceType -> SDoc
- pprParendIfaceType :: IfaceType -> SDoc
- pprIfaceContext :: [IfacePredType] -> SDoc
- pprIfaceContextArr :: [IfacePredType] -> SDoc
- pprIfaceIdBndr :: IfaceIdBndr -> SDoc
- pprIfaceLamBndr :: IfaceLamBndr -> SDoc
- pprIfaceTvBndr :: Bool -> IfaceTvBndr -> SDoc
- pprIfaceTyConBinders :: [IfaceTyConBinder] -> SDoc
- pprIfaceBndrs :: [IfaceBndr] -> SDoc
- pprIfaceTcArgs :: IfaceTcArgs -> SDoc
- pprParendIfaceTcArgs :: IfaceTcArgs -> SDoc
- pprIfaceForAllPart :: [IfaceForAllBndr] -> [IfacePredType] -> SDoc -> SDoc
- pprIfaceForAll :: [IfaceForAllBndr] -> SDoc
- pprIfaceSigmaType :: ShowForAllFlag -> IfaceType -> SDoc
- pprIfaceTyLit :: IfaceTyLit -> SDoc
- pprIfaceCoercion :: IfaceCoercion -> SDoc
- pprParendIfaceCoercion :: IfaceCoercion -> SDoc
- splitIfaceSigmaTy :: IfaceType -> ([IfaceForAllBndr], [IfacePredType], IfaceType)
- pprIfaceTypeApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc
- pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc
- pprIfaceCoTcApp :: TyPrec -> IfaceTyCon -> [IfaceCoercion] -> SDoc
- pprTyTcApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc
- pprIfacePrefixApp :: TyPrec -> SDoc -> [SDoc] -> SDoc
- suppressIfaceInvisibles :: DynFlags -> [IfaceTyConBinder] -> [a] -> [a]
- stripIfaceInvisVars :: DynFlags -> [IfaceTyConBinder] -> [IfaceTyConBinder]
- stripInvisArgs :: DynFlags -> IfaceTcArgs -> IfaceTcArgs
- substIfaceType :: IfaceTySubst -> IfaceType -> IfaceType
- substIfaceTyVar :: IfaceTySubst -> IfLclName -> IfaceType
- substIfaceTcArgs :: IfaceTySubst -> IfaceTcArgs -> IfaceTcArgs
- mkIfaceTySubst :: [IfaceTvBndr] -> [IfaceType] -> IfaceTySubst
- eqIfaceTvBndr :: IfaceTvBndr -> IfaceTvBndr -> Bool

# Documentation

type IfExtName = Name #

type IfLclName = FastString #

data IfaceType #

Constructors

IfaceFreeTyVar TyVar |
IfaceTyVar IfLclName |
IfaceLitTy IfaceTyLit |
IfaceAppTy IfaceType IfaceType |
IfaceFunTy IfaceType IfaceType |
IfaceDFunTy IfaceType IfaceType |
IfaceForAllTy IfaceForAllBndr IfaceType |
IfaceTyConApp IfaceTyCon IfaceTcArgs |
IfaceCastTy IfaceType IfaceCoercion |
IfaceCoercionTy IfaceCoercion |
IfaceTupleTy TupleSort IsPromoted IfaceTcArgs |

Instances

Outputable IfaceType # |
Methods ppr :: IfaceType -> SDoc # pprPrec :: Rational -> IfaceType -> SDoc #
Binary IfaceType # |
Methods put_ :: BinHandle -> IfaceType -> IO () # put :: BinHandle -> IfaceType -> IO (Bin * IfaceType) # get :: BinHandle -> IO IfaceType #
Binary (DefMethSpec IfaceType) # |
Methods put_ :: BinHandle -> DefMethSpec IfaceType -> IO () # put :: BinHandle -> DefMethSpec IfaceType -> IO (Bin * (DefMethSpec IfaceType)) # get :: BinHandle -> IO (DefMethSpec IfaceType) #

type IfacePredType = IfaceType #

type IfaceKind = IfaceType #

data IfaceCoercion #

Constructors

IfaceReflCo Role IfaceType |
IfaceFunCo Role IfaceCoercion IfaceCoercion |
IfaceTyConAppCo Role IfaceTyCon [IfaceCoercion] |
IfaceAppCo IfaceCoercion IfaceCoercion |
IfaceForAllCo IfaceTvBndr IfaceCoercion IfaceCoercion |
IfaceCoVarCo IfLclName |
IfaceAxiomInstCo IfExtName BranchIndex [IfaceCoercion] |
IfaceUnivCo IfaceUnivCoProv Role IfaceType IfaceType |
IfaceSymCo IfaceCoercion |
IfaceTransCo IfaceCoercion IfaceCoercion |
IfaceNthCo Int IfaceCoercion |
IfaceLRCo LeftOrRight IfaceCoercion |
IfaceInstCo IfaceCoercion IfaceCoercion |
IfaceCoherenceCo IfaceCoercion IfaceCoercion |
IfaceKindCo IfaceCoercion |
IfaceSubCo IfaceCoercion |
IfaceAxiomRuleCo IfLclName [IfaceCoercion] |

Instances

Outputable IfaceCoercion # |
Methods ppr :: IfaceCoercion -> SDoc # pprPrec :: Rational -> IfaceCoercion -> SDoc #
Binary IfaceCoercion # |
Methods put_ :: BinHandle -> IfaceCoercion -> IO () # put :: BinHandle -> IfaceCoercion -> IO (Bin * IfaceCoercion) # get :: BinHandle -> IO IfaceCoercion #

data IfaceUnivCoProv #

Constructors

IfaceUnsafeCoerceProv |
IfacePhantomProv IfaceCoercion |
IfaceProofIrrelProv IfaceCoercion |
IfacePluginProv String |
IfaceHoleProv Unique | See Note [Holes in IfaceUnivCoProv]

Instances

Binary IfaceUnivCoProv # |
Methods put_ :: BinHandle -> IfaceUnivCoProv -> IO () # put :: BinHandle -> IfaceUnivCoProv -> IO (Bin * IfaceUnivCoProv) # get :: BinHandle -> IO IfaceUnivCoProv #

data IfaceTyCon #

Constructors

IfaceTyCon |

Fields

- ifaceTyConName :: IfExtName
- ifaceTyConInfo :: IfaceTyConInfo

Instances

Eq IfaceTyCon # |
Methods (==) :: IfaceTyCon -> IfaceTyCon -> Bool # (/=) :: IfaceTyCon -> IfaceTyCon -> Bool #
Outputable IfaceTyCon # |
Methods ppr :: IfaceTyCon -> SDoc # pprPrec :: Rational -> IfaceTyCon -> SDoc #
Binary IfaceTyCon # |
Methods put_ :: BinHandle -> IfaceTyCon -> IO () # put :: BinHandle -> IfaceTyCon -> IO (Bin * IfaceTyCon) # get :: BinHandle -> IO IfaceTyCon #

data IfaceTyConInfo #

Constructors

IfaceTyConInfo |

Fields

- ifaceTyConIsPromoted :: IsPromoted
- ifaceTyConSort :: IfaceTyConSort

Instances

Eq IfaceTyConInfo # |
Methods (==) :: IfaceTyConInfo -> IfaceTyConInfo -> Bool # (/=) :: IfaceTyConInfo -> IfaceTyConInfo -> Bool #
Binary IfaceTyConInfo # |
Methods put_ :: BinHandle -> IfaceTyConInfo -> IO () # put :: BinHandle -> IfaceTyConInfo -> IO (Bin * IfaceTyConInfo) # get :: BinHandle -> IO IfaceTyConInfo #

data IfaceTyConSort #

The various types of TyCons which have special, built-in syntax.

Constructors

IfaceNormalTyCon | a regular tycon
IfaceTupleTyCon !Arity !TupleSort | e.g. `(a, b, c)` or `()`. The arity is the tuple width, not the tycon arity (which is twice the width in the case of unboxed tuples).
IfaceSumTyCon !Arity | e.g. `(a | b | c)`
IfaceEqualityTyCon !Bool | a type equality. `True` indicates kind-homogeneous. See Note [Equality predicates in IfaceType] for details.

Instances

Eq IfaceTyConSort # |
Methods (==) :: IfaceTyConSort -> IfaceTyConSort -> Bool # (/=) :: IfaceTyConSort -> IfaceTyConSort -> Bool #
Binary IfaceTyConSort # |
Methods put_ :: BinHandle -> IfaceTyConSort -> IO () # put :: BinHandle -> IfaceTyConSort -> IO (Bin * IfaceTyConSort) # get :: BinHandle -> IO IfaceTyConSort #

data IsPromoted #

Is a TyCon a promoted data constructor or just a normal type constructor?

Constructors

IsNotPromoted |
IsPromoted |

Instances

Eq IsPromoted # |
Methods (==) :: IsPromoted -> IsPromoted -> Bool # (/=) :: IsPromoted -> IsPromoted -> Bool #
Binary IsPromoted # |
Methods put_ :: BinHandle -> IsPromoted -> IO () # put :: BinHandle -> IsPromoted -> IO (Bin * IsPromoted) # get :: BinHandle -> IO IsPromoted #

data IfaceTyLit #

Constructors

IfaceNumTyLit Integer |
IfaceStrTyLit FastString |

Instances

Eq IfaceTyLit # |
Methods (==) :: IfaceTyLit -> IfaceTyLit -> Bool # (/=) :: IfaceTyLit -> IfaceTyLit -> Bool #
Outputable IfaceTyLit # |
Methods ppr :: IfaceTyLit -> SDoc # pprPrec :: Rational -> IfaceTyLit -> SDoc #
Binary IfaceTyLit # |
Methods put_ :: BinHandle -> IfaceTyLit -> IO () # put :: BinHandle -> IfaceTyLit -> IO (Bin * IfaceTyLit) # get :: BinHandle -> IO IfaceTyLit #

data IfaceTcArgs #

Constructors

ITC_Nil |
ITC_Vis IfaceType IfaceTcArgs |
ITC_Invis IfaceKind IfaceTcArgs |

Instances

Monoid IfaceTcArgs # |
Methods mempty :: IfaceTcArgs Source # mappend :: IfaceTcArgs -> IfaceTcArgs -> IfaceTcArgs Source # mconcat :: [IfaceTcArgs] -> IfaceTcArgs Source #
Outputable IfaceTcArgs # |
Methods ppr :: IfaceTcArgs -> SDoc # pprPrec :: Rational -> IfaceTcArgs -> SDoc #
Binary IfaceTcArgs # |
Methods put_ :: BinHandle -> IfaceTcArgs -> IO () # put :: BinHandle -> IfaceTcArgs -> IO (Bin * IfaceTcArgs) # get :: BinHandle -> IO IfaceTcArgs #

type IfaceContext = [IfacePredType] #

data IfaceBndr #

Constructors

IfaceIdBndr !IfaceIdBndr |
IfaceTvBndr !IfaceTvBndr |

Instances

Outputable IfaceBndr # |
Methods ppr :: IfaceBndr -> SDoc # pprPrec :: Rational -> IfaceBndr -> SDoc #
Binary IfaceBndr # |
Methods put_ :: BinHandle -> IfaceBndr -> IO () # put :: BinHandle -> IfaceBndr -> IO (Bin * IfaceBndr) # get :: BinHandle -> IO IfaceBndr #

data IfaceOneShot #

Constructors

IfaceNoOneShot |
IfaceOneShot |

Instances

Binary IfaceOneShot # |
Methods put_ :: BinHandle -> IfaceOneShot -> IO () # put :: BinHandle -> IfaceOneShot -> IO (Bin * IfaceOneShot) # get :: BinHandle -> IO IfaceOneShot #

type IfaceLamBndr = (IfaceBndr, IfaceOneShot) #

type IfaceTvBndr = (IfLclName, IfaceKind) #

type IfaceIdBndr = (IfLclName, IfaceType) #

type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis #

type IfaceForAllBndr = TyVarBndr IfaceTvBndr ArgFlag #

data ArgFlag #

Argument Flag

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 [TyBinders and ArgFlags] in TyCoRep

Constructors

Required |
Specified |
Inferred |

Instances

Eq ArgFlag # |
Methods (==) :: ArgFlag -> ArgFlag -> Bool # (/=) :: ArgFlag -> ArgFlag -> Bool #
Data ArgFlag # |

Methods

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

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

toConstr :: ArgFlag -> Constr Source #

dataTypeOf :: ArgFlag -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Outputable ArgFlag # |
Methods ppr :: ArgFlag -> SDoc # pprPrec :: Rational -> ArgFlag -> SDoc #
Binary ArgFlag # |
Methods put_ :: BinHandle -> ArgFlag -> IO () # put :: BinHandle -> ArgFlag -> IO (Bin * ArgFlag) # get :: BinHandle -> IO ArgFlag #
Outputable tv => Outputable (TyVarBndr tv ArgFlag) # |
Methods ppr :: TyVarBndr tv ArgFlag -> SDoc # pprPrec :: Rational -> TyVarBndr tv ArgFlag -> SDoc #

data ShowForAllFlag #

Show forall flag

Unconditionally show the forall quantifier with (`ShowForAllMust`) or when (`ShowForAllWhen`) the names used are free in the binder or when compiling with -fprint-explicit-foralls.

Constructors

ShowForAllMust |
ShowForAllWhen |

ifTyConBinderTyVar :: IfaceTyConBinder -> IfaceTvBndr #

Extract a IfaceTvBndr from a IfaceTyConBinder

ifTyConBinderName :: IfaceTyConBinder -> IfLclName #

Extract the variable name from a IfaceTyConBinder

data IfRnEnv2 #

emptyIfRnEnv2 :: IfRnEnv2 #

eqIfaceType :: IfRnEnv2 -> IfaceType -> IfaceType -> Bool #

eqIfaceTypes :: IfRnEnv2 -> [IfaceType] -> [IfaceType] -> Bool #

eqIfaceTcArgs :: IfRnEnv2 -> IfaceTcArgs -> IfaceTcArgs -> Bool #

eqIfaceTvBndrs :: IfRnEnv2 -> [IfaceTvBndr] -> [IfaceTvBndr] -> Maybe IfRnEnv2 #

Similar to `eqTyVarBndrs`, checks that tyvar lists are the same length and have matching kinds; if so, extend the `IfRnEnv2`. Returns `Nothing` if they don't match.

isIfaceLiftedTypeKind :: IfaceKind -> Bool #

tcArgsIfaceTypes :: IfaceTcArgs -> [IfaceType] #

pprIfaceType :: IfaceType -> SDoc #

pprParendIfaceType :: IfaceType -> SDoc #

pprIfaceContext :: [IfacePredType] -> SDoc #

Prints a context or `()` if empty. This is used when, e.g., we want to display a context in an error message.

pprIfaceContextArr :: [IfacePredType] -> SDoc #

Prints "(C a, D b) =>", including the arrow. This is used when we want to print a context in a type.

pprIfaceIdBndr :: IfaceIdBndr -> SDoc #

pprIfaceLamBndr :: IfaceLamBndr -> SDoc #

pprIfaceTvBndr :: Bool -> IfaceTvBndr -> SDoc #

pprIfaceTyConBinders :: [IfaceTyConBinder] -> SDoc #

pprIfaceBndrs :: [IfaceBndr] -> SDoc #

pprIfaceTcArgs :: IfaceTcArgs -> SDoc #

pprParendIfaceTcArgs :: IfaceTcArgs -> SDoc #

pprIfaceForAllPart :: [IfaceForAllBndr] -> [IfacePredType] -> SDoc -> SDoc #

pprIfaceForAll :: [IfaceForAllBndr] -> SDoc #

Render the "forall ... ." or "forall ... ->" bit of a type.

pprIfaceSigmaType :: ShowForAllFlag -> IfaceType -> SDoc #

pprIfaceTyLit :: IfaceTyLit -> SDoc #

pprIfaceCoercion :: IfaceCoercion -> SDoc #

pprParendIfaceCoercion :: IfaceCoercion -> SDoc #

splitIfaceSigmaTy :: IfaceType -> ([IfaceForAllBndr], [IfacePredType], IfaceType) #

pprIfaceTypeApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc #

pprUserIfaceForAll :: [IfaceForAllBndr] -> SDoc #

pprIfaceCoTcApp :: TyPrec -> IfaceTyCon -> [IfaceCoercion] -> SDoc #

pprTyTcApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> SDoc #

pprIfacePrefixApp :: TyPrec -> SDoc -> [SDoc] -> SDoc #

suppressIfaceInvisibles :: DynFlags -> [IfaceTyConBinder] -> [a] -> [a] #

stripIfaceInvisVars :: DynFlags -> [IfaceTyConBinder] -> [IfaceTyConBinder] #

stripInvisArgs :: DynFlags -> IfaceTcArgs -> IfaceTcArgs #

substIfaceType :: IfaceTySubst -> IfaceType -> IfaceType #

substIfaceTyVar :: IfaceTySubst -> IfLclName -> IfaceType #

substIfaceTcArgs :: IfaceTySubst -> IfaceTcArgs -> IfaceTcArgs #

mkIfaceTySubst :: [IfaceTvBndr] -> [IfaceType] -> IfaceTySubst #

eqIfaceTvBndr :: IfaceTvBndr -> IfaceTvBndr -> Bool #