ghc-7.8.2: The GHC API

Safe Haskell | None
Language | Haskell98

FamInstEnv

Contents

- CoAxioms

Synopsis

- data FamInst = FamInst {
  - fi_axiom :: CoAxiom Unbranched
  - fi_flavor :: FamFlavor
  - fi_fam :: Name
  - fi_tcs :: [Maybe Name]
  - fi_tvs :: [TyVar]
  - fi_tys :: [Type]
  - fi_rhs :: Type
  }
- data FamFlavor
  - = SynFamilyInst
  - | DataFamilyInst TyCon
- famInstAxiom :: FamInst -> CoAxiom Unbranched
- famInstTyCon :: FamInst -> TyCon
- famInstRHS :: FamInst -> Type
- famInstsRepTyCons :: [FamInst] -> [TyCon]
- famInstRepTyCon_maybe :: FamInst -> Maybe TyCon
- dataFamInstRepTyCon :: FamInst -> TyCon
- pprFamInst :: FamInst -> SDoc
- pprFamInstHdr :: FamInst -> SDoc
- pprFamInsts :: [FamInst] -> SDoc
- mkImportedFamInst :: Name -> [Maybe Name] -> CoAxiom Unbranched -> FamInst
- type FamInstEnvs = (FamInstEnv, FamInstEnv)
- type FamInstEnv = UniqFM FamilyInstEnv
- emptyFamInstEnv :: FamInstEnv
- emptyFamInstEnvs :: (FamInstEnv, FamInstEnv)
- extendFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv
- deleteFromFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv
- extendFamInstEnvList :: FamInstEnv -> [FamInst] -> FamInstEnv
- identicalFamInst :: FamInst -> FamInst -> Bool
- famInstEnvElts :: FamInstEnv -> [FamInst]
- familyInstances :: (FamInstEnv, FamInstEnv) -> TyCon -> [FamInst]
- orphNamesOfFamInst :: FamInst -> NameSet
- mkCoAxBranch :: [TyVar] -> [Type] -> Type -> SrcSpan -> CoAxBranch
- mkBranchedCoAxiom :: Name -> TyCon -> [CoAxBranch] -> CoAxiom Branched
- mkUnbranchedCoAxiom :: Name -> TyCon -> CoAxBranch -> CoAxiom Unbranched
- mkSingleCoAxiom :: Name -> [TyVar] -> TyCon -> [Type] -> Type -> CoAxiom Unbranched
- computeAxiomIncomps :: CoAxiom br -> CoAxiom br
- data FamInstMatch = FamInstMatch {
  - fim_instance :: FamInst
  - fim_tys :: [Type]
  }
- lookupFamInstEnv :: FamInstEnvs -> TyCon -> [Type] -> [FamInstMatch]
- lookupFamInstEnvConflicts :: FamInstEnvs -> FamInst -> [FamInstMatch]
- isDominatedBy :: CoAxBranch -> [CoAxBranch] -> Bool
- instNewTyConTF_maybe :: FamInstEnvs -> TyCon -> [Type] -> Maybe (Type, Coercion)
- chooseBranch :: CoAxiom Branched -> [Type] -> Maybe (BranchIndex, [Type])
- topNormaliseType :: FamInstEnvs -> Type -> Type
- topNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Coercion, Type)
- normaliseType :: FamInstEnvs -> Role -> Type -> (Coercion, Type)
- normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> (Coercion, Type)
- flattenTys :: InScopeSet -> [Type] -> [Type]

# Documentation

data FamInst

Constructors

FamInst |
Fields fi_axiom :: CoAxiom Unbranched fi_flavor :: FamFlavor fi_fam :: Name fi_tcs :: [Maybe Name] fi_tvs :: [TyVar] fi_tys :: [Type] fi_rhs :: Type

Instances

Outputable FamInst |
NamedThing FamInst |

data FamFlavor

Constructors

SynFamilyInst |
DataFamilyInst TyCon |

famInstAxiom :: FamInst -> CoAxiom Unbranched

famInstTyCon :: FamInst -> TyCon

famInstRHS :: FamInst -> Type

famInstsRepTyCons :: [FamInst] -> [TyCon]

famInstRepTyCon_maybe :: FamInst -> Maybe TyCon

dataFamInstRepTyCon :: FamInst -> TyCon

pprFamInst :: FamInst -> SDoc

pprFamInstHdr :: FamInst -> SDoc

pprFamInsts :: [FamInst] -> SDoc

mkImportedFamInst :: Name -> [Maybe Name] -> CoAxiom Unbranched -> FamInst

type FamInstEnvs = (FamInstEnv, FamInstEnv)

type FamInstEnv = UniqFM FamilyInstEnv

emptyFamInstEnv :: FamInstEnv

emptyFamInstEnvs :: (FamInstEnv, FamInstEnv)

extendFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv

deleteFromFamInstEnv :: FamInstEnv -> FamInst -> FamInstEnv

extendFamInstEnvList :: FamInstEnv -> [FamInst] -> FamInstEnv

identicalFamInst :: FamInst -> FamInst -> Bool

famInstEnvElts :: FamInstEnv -> [FamInst]

familyInstances :: (FamInstEnv, FamInstEnv) -> TyCon -> [FamInst]

orphNamesOfFamInst :: FamInst -> NameSet

Collects the names of the concrete types and type constructors that make up the LHS of a type family instance, including the family name itself.

For instance, given `type family Foo a b`: `type instance Foo (F (G (H a))) b = ...` would yield [Foo,F,G,H]

Used in the implementation of ":info" in GHCi.

# CoAxioms

mkCoAxBranch :: [TyVar] -> [Type] -> Type -> SrcSpan -> CoAxBranch

mkBranchedCoAxiom :: Name -> TyCon -> [CoAxBranch] -> CoAxiom Branched

mkUnbranchedCoAxiom :: Name -> TyCon -> CoAxBranch -> CoAxiom Unbranched

mkSingleCoAxiom :: Name -> [TyVar] -> TyCon -> [Type] -> Type -> CoAxiom Unbranched

computeAxiomIncomps :: CoAxiom br -> CoAxiom br

data FamInstMatch

Constructors

FamInstMatch |
Fields fim_instance :: FamInst fim_tys :: [Type]

Instances

Outputable FamInstMatch |

lookupFamInstEnv :: FamInstEnvs -> TyCon -> [Type] -> [FamInstMatch]

lookupFamInstEnvConflicts :: FamInstEnvs -> FamInst -> [FamInstMatch]

isDominatedBy :: CoAxBranch -> [CoAxBranch] -> Bool

instNewTyConTF_maybe :: FamInstEnvs -> TyCon -> [Type] -> Maybe (Type, Coercion)

Unwrap a newtype of a newtype intances. This is analogous to Coercion.instNewTyCon_maybe; differences are: * it also lookups up newtypes families, and * it does not require the newtype to be saturated. (a requirement using it for Coercible)

chooseBranch :: CoAxiom Branched -> [Type] -> Maybe (BranchIndex, [Type])

topNormaliseType :: FamInstEnvs -> Type -> Type

topNormaliseType_maybe :: FamInstEnvs -> Type -> Maybe (Coercion, Type)

normaliseType :: FamInstEnvs -> Role -> Type -> (Coercion, Type)

normaliseTcApp :: FamInstEnvs -> Role -> TyCon -> [Type] -> (Coercion, Type)

flattenTys :: InScopeSet -> [Type] -> [Type]