CoAxiom

ghc-7.8.2: The GHC API

Safe Haskell | None
Language | Haskell98

CoAxiom

Description

Module for coercion axioms, used to represent type family instances and newtypes

Synopsis

- data Branched
- data Unbranched
- type BranchIndex = Int
- data BranchList a br where
  - FirstBranch :: a -> BranchList a br
  - NextBranch :: a -> BranchList a br -> BranchList a Branched
- toBranchList :: [a] -> BranchList a Branched
- fromBranchList :: BranchList a br -> [a]
- toBranchedList :: BranchList a br -> BranchList a Branched
- toUnbranchedList :: BranchList a br -> BranchList a Unbranched
- brListLength :: BranchList a br -> Int
- brListNth :: BranchList a br -> BranchIndex -> a
- brListMap :: (a -> b) -> BranchList a br -> [b]
- brListFoldr :: (a -> b -> b) -> b -> BranchList a br -> b
- brListMapM :: Monad m => (a -> m b) -> BranchList a br -> m [b]
- brListFoldlM_ :: forall a b m br. Monad m => (a -> b -> m a) -> a -> BranchList b br -> m ()
- brListZipWith :: (a -> b -> c) -> BranchList a br1 -> BranchList b br2 -> [c]
- data CoAxiom br = CoAxiom {
  - co_ax_unique :: Unique
  - co_ax_name :: Name
  - co_ax_role :: Role
  - co_ax_tc :: TyCon
  - co_ax_branches :: BranchList CoAxBranch br
  - co_ax_implicit :: Bool
  }
- data CoAxBranch = CoAxBranch {
  - cab_loc :: SrcSpan
  - cab_tvs :: [TyVar]
  - cab_roles :: [Role]
  - cab_lhs :: [Type]
  - cab_rhs :: Type
  - cab_incomps :: [CoAxBranch]
  }
- toBranchedAxiom :: CoAxiom br -> CoAxiom Branched
- toUnbranchedAxiom :: CoAxiom br -> CoAxiom Unbranched
- coAxiomName :: CoAxiom br -> Name
- coAxiomArity :: CoAxiom br -> BranchIndex -> Arity
- coAxiomBranches :: CoAxiom br -> BranchList CoAxBranch br
- coAxiomTyCon :: CoAxiom br -> TyCon
- isImplicitCoAxiom :: CoAxiom br -> Bool
- coAxiomNumPats :: CoAxiom br -> Int
- coAxiomNthBranch :: CoAxiom br -> BranchIndex -> CoAxBranch
- coAxiomSingleBranch_maybe :: CoAxiom br -> Maybe CoAxBranch
- coAxiomRole :: CoAxiom br -> Role
- coAxiomSingleBranch :: CoAxiom Unbranched -> CoAxBranch
- coAxBranchTyVars :: CoAxBranch -> [TyVar]
- coAxBranchRoles :: CoAxBranch -> [Role]
- coAxBranchLHS :: CoAxBranch -> [Type]
- coAxBranchRHS :: CoAxBranch -> Type
- coAxBranchSpan :: CoAxBranch -> SrcSpan
- coAxBranchIncomps :: CoAxBranch -> [CoAxBranch]
- placeHolderIncomps :: [CoAxBranch]
- data Role
  - = Nominal
  - | Representational
  - | Phantom
- fsFromRole :: Role -> FastString
- data CoAxiomRule = CoAxiomRule {
  - coaxrName :: FastString
  - coaxrTypeArity :: Int
  - coaxrAsmpRoles :: [Role]
  - coaxrRole :: Role
  - coaxrProves :: [Type] -> [Eqn] -> Maybe Eqn
  }
- type Eqn = Pair Type
- data BuiltInSynFamily = BuiltInSynFamily {
  - sfMatchFam :: [Type] -> Maybe (CoAxiomRule, [Type], Type)
  - sfInteractTop :: [Type] -> Type -> [Eqn]
  - sfInteractInert :: [Type] -> Type -> [Type] -> Type -> [Eqn]
  }
- trivialBuiltInFamily :: BuiltInSynFamily

# Documentation

data Branched Source

Instances

Typeable * Branched |

data Unbranched Source

Instances

Typeable * Unbranched |

type BranchIndex = Int Source

data BranchList a br where Source

Constructors

FirstBranch :: a -> BranchList a br |
NextBranch :: a -> BranchList a br -> BranchList a Branched |

Instances

Outputable a => Outputable (BranchList a br) |

toBranchList :: [a] -> BranchList a Branched Source

fromBranchList :: BranchList a br -> [a] Source

toBranchedList :: BranchList a br -> BranchList a Branched Source

toUnbranchedList :: BranchList a br -> BranchList a Unbranched Source

brListLength :: BranchList a br -> Int Source

brListNth :: BranchList a br -> BranchIndex -> a Source

brListMap :: (a -> b) -> BranchList a br -> [b] Source

brListFoldr :: (a -> b -> b) -> b -> BranchList a br -> b Source

brListMapM :: Monad m => (a -> m b) -> BranchList a br -> m [b] Source

brListFoldlM_ :: forall a b m br. Monad m => (a -> b -> m a) -> a -> BranchList b br -> m () Source

brListZipWith :: (a -> b -> c) -> BranchList a br1 -> BranchList b br2 -> [c] Source

data CoAxiom br Source

A `CoAxiom` is a "coercion constructor", i.e. a named equality axiom.

Constructors

CoAxiom |
Fields co_ax_unique :: Unique co_ax_name :: Name co_ax_role :: Role co_ax_tc :: TyCon co_ax_branches :: BranchList CoAxBranch br co_ax_implicit :: Bool

Instances

Eq (CoAxiom br) |
Typeable * br => Data (CoAxiom br) |
Ord (CoAxiom br) |
Outputable (CoAxiom br) |
Uniquable (CoAxiom br) |
NamedThing (CoAxiom br) |
Typeable (* -> *) CoAxiom |

data CoAxBranch Source

Constructors

CoAxBranch |
Fields cab_loc :: SrcSpan cab_tvs :: [TyVar] cab_roles :: [Role] cab_lhs :: [Type] cab_rhs :: Type cab_incomps :: [CoAxBranch]

Instances

Typeable * CoAxBranch |

toBranchedAxiom :: CoAxiom br -> CoAxiom Branched Source

toUnbranchedAxiom :: CoAxiom br -> CoAxiom Unbranched Source

coAxiomName :: CoAxiom br -> Name Source

coAxiomArity :: CoAxiom br -> BranchIndex -> Arity Source

coAxiomBranches :: CoAxiom br -> BranchList CoAxBranch br Source

coAxiomTyCon :: CoAxiom br -> TyCon Source

isImplicitCoAxiom :: CoAxiom br -> Bool Source

coAxiomNumPats :: CoAxiom br -> Int Source

coAxiomNthBranch :: CoAxiom br -> BranchIndex -> CoAxBranch Source

coAxiomSingleBranch_maybe :: CoAxiom br -> Maybe CoAxBranch Source

coAxiomRole :: CoAxiom br -> Role Source

coAxiomSingleBranch :: CoAxiom Unbranched -> CoAxBranch Source

coAxBranchTyVars :: CoAxBranch -> [TyVar] Source

coAxBranchRoles :: CoAxBranch -> [Role] Source

coAxBranchLHS :: CoAxBranch -> [Type] Source

coAxBranchRHS :: CoAxBranch -> Type Source

coAxBranchSpan :: CoAxBranch -> SrcSpan Source

coAxBranchIncomps :: CoAxBranch -> [CoAxBranch] Source

placeHolderIncomps :: [CoAxBranch] Source

data Role Source

Constructors

Nominal |
Representational |
Phantom |

Instances

Eq Role |
Data Role |
Outputable Role |
Binary Role |
Typeable * Role |

fsFromRole :: Role -> FastString Source

data CoAxiomRule Source

For now, we work only with nominal equality.

Constructors

CoAxiomRule |
Fields coaxrName :: FastString coaxrTypeArity :: Int coaxrAsmpRoles :: [Role] coaxrRole :: Role coaxrProves :: [Type] -> [Eqn] -> Maybe Eqn coaxrProves returns `Nothing` when it doesn't like the supplied arguments. When this happens in a coercion that means that the coercion is ill-formed, and Core Lint checks for that.

Instances

Eq CoAxiomRule |
Data CoAxiomRule |
Ord CoAxiomRule |
Outputable CoAxiomRule |
Uniquable CoAxiomRule |
Typeable * CoAxiomRule |

type Eqn = Pair Type Source

A more explicit representation for `t1 ~ t2`.

data BuiltInSynFamily Source

Constructors

BuiltInSynFamily |
Fields sfMatchFam :: [Type] -> Maybe (CoAxiomRule, [Type], Type) sfInteractTop :: [Type] -> Type -> [Eqn] sfInteractInert :: [Type] -> Type -> [Type] -> Type -> [Eqn]

trivialBuiltInFamily :: BuiltInSynFamily Source