ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

TcEvidence

Synopsis

- data HsWrapper
  - = WpHole
  - | WpCompose HsWrapper HsWrapper
  - | WpFun HsWrapper HsWrapper TcType TcType
  - | WpCast TcCoercion
  - | WpEvLam EvVar
  - | WpEvApp EvTerm
  - | WpTyLam TyVar
  - | WpTyApp KindOrType
  - | WpLet TcEvBinds
- (<.>) :: HsWrapper -> HsWrapper -> HsWrapper
- mkWpTyApps :: [Type] -> HsWrapper
- mkWpEvApps :: [EvTerm] -> HsWrapper
- mkWpEvVarApps :: [EvVar] -> HsWrapper
- mkWpTyLams :: [TyVar] -> HsWrapper
- mkWpLams :: [Var] -> HsWrapper
- mkWpLet :: TcEvBinds -> HsWrapper
- mkWpCast :: TcCoercion -> HsWrapper
- mkWpFun :: HsWrapper -> HsWrapper -> TcType -> TcType -> HsWrapper
- idHsWrapper :: HsWrapper
- isIdHsWrapper :: HsWrapper -> Bool
- pprHsWrapper :: SDoc -> HsWrapper -> SDoc
- data TcEvBinds
  - = TcEvBinds EvBindsVar
  - | EvBinds (Bag EvBind)
- data EvBindsVar = EvBindsVar (IORef EvBindMap) Unique
- newtype EvBindMap = EvBindMap {
  - ev_bind_varenv :: VarEnv EvBind
  }
- emptyEvBindMap :: EvBindMap
- extendEvBinds :: EvBindMap -> EvVar -> EvTerm -> EvBindMap
- lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind
- evBindMapBinds :: EvBindMap -> Bag EvBind
- data EvBind = EvBind EvVar EvTerm
- emptyTcEvBinds :: TcEvBinds
- isEmptyTcEvBinds :: TcEvBinds -> Bool
- data EvTerm
  - = EvId EvId
  - | EvCoercion TcCoercion
  - | EvCast EvTerm TcCoercion
  - | EvDFunApp DFunId [Type] [EvTerm]
  - | EvTupleSel EvTerm Int
  - | EvTupleMk [EvTerm]
  - | EvDelayedError Type FastString
  - | EvSuperClass EvTerm Int
  - | EvLit EvLit
  - | EvTypeable EvTypeable
  - | EvCallStack EvCallStack
- mkEvCast :: EvTerm -> TcCoercion -> EvTerm
- evVarsOfTerm :: EvTerm -> VarSet
- mkEvTupleSelectors :: EvTerm -> [TcPredType] -> [(TcPredType, EvTerm)]
- mkEvScSelectors :: EvTerm -> Class -> [TcType] -> [(TcPredType, EvTerm)]
- data EvLit
  - = EvNum Integer
  - | EvStr FastString
- evTermCoercion :: EvTerm -> TcCoercion
- data EvTypeable
  - = EvTypeableTyCon TyCon [Kind]
  - | EvTypeableTyApp (EvTerm, Type) (EvTerm, Type)
  - | EvTypeableTyLit Type
- data EvCallStack
  - = EvCsEmpty
  - | EvCsPushCall Name RealSrcSpan EvTerm
  - | EvCsTop FastString RealSrcSpan EvTerm
- data TcCoercion
  - = TcRefl Role TcType
  - | TcTyConAppCo Role TyCon [TcCoercion]
  - | TcAppCo TcCoercion TcCoercion
  - | TcForAllCo TyVar TcCoercion
  - | TcCoVarCo EqVar
  - | TcAxiomInstCo (CoAxiom Branched) Int [TcCoercion]
  - | TcAxiomRuleCo CoAxiomRule [TcType] [TcCoercion]
  - | TcPhantomCo TcType TcType
  - | TcSymCo TcCoercion
  - | TcTransCo TcCoercion TcCoercion
  - | TcNthCo Int TcCoercion
  - | TcLRCo LeftOrRight TcCoercion
  - | TcSubCo TcCoercion
  - | TcCastCo TcCoercion TcCoercion
  - | TcLetCo TcEvBinds TcCoercion
  - | TcCoercion Coercion
- data LeftOrRight
  - = CLeft
  - | CRight
- pickLR :: LeftOrRight -> (a, a) -> a
- mkTcReflCo :: Role -> TcType -> TcCoercion
- mkTcNomReflCo :: TcType -> TcCoercion
- mkTcRepReflCo :: TcType -> TcCoercion
- mkTcTyConAppCo :: Role -> TyCon -> [TcCoercion] -> TcCoercion
- mkTcAppCo :: TcCoercion -> TcCoercion -> TcCoercion
- mkTcAppCos :: TcCoercion -> [TcCoercion] -> TcCoercion
- mkTcFunCo :: Role -> TcCoercion -> TcCoercion -> TcCoercion
- mkTcAxInstCo :: Role -> CoAxiom br -> Int -> [TcType] -> TcCoercion
- mkTcUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [TcType] -> TcCoercion
- mkTcForAllCo :: Var -> TcCoercion -> TcCoercion
- mkTcForAllCos :: [Var] -> TcCoercion -> TcCoercion
- mkTcSymCo :: TcCoercion -> TcCoercion
- mkTcTransCo :: TcCoercion -> TcCoercion -> TcCoercion
- mkTcNthCo :: Int -> TcCoercion -> TcCoercion
- mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion
- mkTcSubCo :: TcCoercion -> TcCoercion
- maybeTcSubCo :: EqRel -> TcCoercion -> TcCoercion
- tcDowngradeRole :: Role -> Role -> TcCoercion -> TcCoercion
- mkTcTransAppCo :: Role -> TcCoercion -> TcType -> TcType -> Role -> TcCoercion -> TcType -> TcType -> Role -> TcCoercion
- mkTcAxiomRuleCo :: CoAxiomRule -> [TcType] -> [TcCoercion] -> TcCoercion
- mkTcPhantomCo :: TcType -> TcType -> TcCoercion
- tcCoercionKind :: TcCoercion -> Pair Type
- coVarsOfTcCo :: TcCoercion -> VarSet
- isEqVar :: Var -> Bool
- mkTcCoVarCo :: EqVar -> TcCoercion
- isTcReflCo :: TcCoercion -> Bool
- getTcCoVar_maybe :: TcCoercion -> Maybe CoVar
- tcCoercionRole :: TcCoercion -> Role
- eqVarRole :: EqVar -> Role
- unwrapIP :: Type -> Coercion
- wrapIP :: Type -> Coercion

# Documentation

data HsWrapper

Constructors

WpHole |
WpCompose HsWrapper HsWrapper |
WpFun HsWrapper HsWrapper TcType TcType |
WpCast TcCoercion |
WpEvLam EvVar |
WpEvApp EvTerm |
WpTyLam TyVar |
WpTyApp KindOrType |
WpLet TcEvBinds |

Instances

Data HsWrapper |
Outputable HsWrapper |

(<.>) :: HsWrapper -> HsWrapper -> HsWrapper

mkWpTyApps :: [Type] -> HsWrapper

mkWpEvApps :: [EvTerm] -> HsWrapper

mkWpEvVarApps :: [EvVar] -> HsWrapper

mkWpTyLams :: [TyVar] -> HsWrapper

mkWpLams :: [Var] -> HsWrapper

mkWpLet :: TcEvBinds -> HsWrapper

mkWpCast :: TcCoercion -> HsWrapper

mkWpFun :: HsWrapper -> HsWrapper -> TcType -> TcType -> HsWrapper

idHsWrapper :: HsWrapper

isIdHsWrapper :: HsWrapper -> Bool

pprHsWrapper :: SDoc -> HsWrapper -> SDoc

data TcEvBinds

Constructors

TcEvBinds EvBindsVar |
EvBinds (Bag EvBind) |

Instances

Data TcEvBinds |
Outputable TcEvBinds |

data EvBindsVar

Constructors

EvBindsVar (IORef EvBindMap) Unique |

Instances

Outputable EvBindsVar |

newtype EvBindMap

Constructors

EvBindMap |

Fields

ev_bind_varenv :: VarEnv EvBind

emptyEvBindMap :: EvBindMap

extendEvBinds :: EvBindMap -> EvVar -> EvTerm -> EvBindMap

lookupEvBind :: EvBindMap -> EvVar -> Maybe EvBind

evBindMapBinds :: EvBindMap -> Bag EvBind

data EvBind

Constructors

EvBind EvVar EvTerm |

Instances

Outputable EvBind |

emptyTcEvBinds :: TcEvBinds

isEmptyTcEvBinds :: TcEvBinds -> Bool

data EvTerm

Constructors

EvId EvId |
EvCoercion TcCoercion |
EvCast EvTerm TcCoercion |
EvDFunApp DFunId [Type] [EvTerm] |
EvTupleSel EvTerm Int |
EvTupleMk [EvTerm] |
EvDelayedError Type FastString |
EvSuperClass EvTerm Int |
EvLit EvLit |
EvTypeable EvTypeable |
EvCallStack EvCallStack |

Instances

Data EvTerm |
Outputable EvTerm |

mkEvCast :: EvTerm -> TcCoercion -> EvTerm

evVarsOfTerm :: EvTerm -> VarSet

mkEvTupleSelectors :: EvTerm -> [TcPredType] -> [(TcPredType, EvTerm)]

mkEvScSelectors :: EvTerm -> Class -> [TcType] -> [(TcPredType, EvTerm)]

data EvLit

Constructors

EvNum Integer |
EvStr FastString |

Instances

Data EvLit |
Outputable EvLit |

evTermCoercion :: EvTerm -> TcCoercion

data EvTypeable

Instructions on how to make a `Typeable` dictionary.

Constructors

EvTypeableTyCon TyCon [Kind] | Dicitionary for concrete type constructors.
EvTypeableTyApp (EvTerm, Type) (EvTerm, Type) | Dictionary for type applications; this is used when we have a type expression starting with a type variable (e.g., `Typeable (f a)`)
EvTypeableTyLit Type | Dictionary for a type literal.

Instances

Data EvTypeable |
Outputable EvTypeable |

data EvCallStack

Evidence for `CallStack` implicit parameters.

Constructors

EvCsEmpty |
EvCsPushCall Name RealSrcSpan EvTerm | `EvCsPushCall name loc stk` represents a call to `name`, occurring at `loc`, in a calling context `stk`.
EvCsTop FastString RealSrcSpan EvTerm | `EvCsTop name loc stk` represents a use of an implicit parameter `?name`, occurring at `loc`, in a calling context `stk`.

Instances

Data EvCallStack |
Outputable EvCallStack |

data TcCoercion

Constructors

TcRefl Role TcType |
TcTyConAppCo Role TyCon [TcCoercion] |
TcAppCo TcCoercion TcCoercion |
TcForAllCo TyVar TcCoercion |
TcCoVarCo EqVar |
TcAxiomInstCo (CoAxiom Branched) Int [TcCoercion] |
TcAxiomRuleCo CoAxiomRule [TcType] [TcCoercion] |
TcPhantomCo TcType TcType |
TcSymCo TcCoercion |
TcTransCo TcCoercion TcCoercion |
TcNthCo Int TcCoercion |
TcLRCo LeftOrRight TcCoercion |
TcSubCo TcCoercion |
TcCastCo TcCoercion TcCoercion |
TcLetCo TcEvBinds TcCoercion |
TcCoercion Coercion |

Instances

Data TcCoercion |
Outputable TcCoercion |

data LeftOrRight

Constructors

CLeft |
CRight |

Instances

Eq LeftOrRight |
Data LeftOrRight |
Outputable LeftOrRight |
Binary LeftOrRight |

pickLR :: LeftOrRight -> (a, a) -> a

mkTcReflCo :: Role -> TcType -> TcCoercion

mkTcNomReflCo :: TcType -> TcCoercion

mkTcRepReflCo :: TcType -> TcCoercion

mkTcTyConAppCo :: Role -> TyCon -> [TcCoercion] -> TcCoercion

mkTcAppCo :: TcCoercion -> TcCoercion -> TcCoercion

mkTcAppCos :: TcCoercion -> [TcCoercion] -> TcCoercion

mkTcFunCo :: Role -> TcCoercion -> TcCoercion -> TcCoercion

mkTcAxInstCo :: Role -> CoAxiom br -> Int -> [TcType] -> TcCoercion

mkTcUnbranchedAxInstCo :: Role -> CoAxiom Unbranched -> [TcType] -> TcCoercion

mkTcForAllCo :: Var -> TcCoercion -> TcCoercion

mkTcForAllCos :: [Var] -> TcCoercion -> TcCoercion

mkTcSymCo :: TcCoercion -> TcCoercion

mkTcTransCo :: TcCoercion -> TcCoercion -> TcCoercion

mkTcNthCo :: Int -> TcCoercion -> TcCoercion

mkTcLRCo :: LeftOrRight -> TcCoercion -> TcCoercion

mkTcSubCo :: TcCoercion -> TcCoercion

maybeTcSubCo :: EqRel -> TcCoercion -> TcCoercion

If the EqRel is ReprEq, makes a TcSubCo; otherwise, does nothing. Note that the input coercion should always be nominal.

tcDowngradeRole

Arguments

:: Role | desired role
-> Role | current role
-> TcCoercion |
-> TcCoercion |

Change the role of a `TcCoercion`. Panics if this isn't a downgrade.

mkTcTransAppCo

Arguments

:: Role | r1
-> TcCoercion | co1 :: ty1a ~r1 ty1b
-> TcType | ty1a
-> TcType | ty1b
-> Role | r2
-> TcCoercion | co2 :: ty2a ~r2 ty2b
-> TcType | ty2a
-> TcType | ty2b
-> Role | r3
-> TcCoercion | :: ty1a ty2a ~r3 ty1b ty2b

Like `mkTcAppCo`, but allows the second coercion to be other than nominal. See Note [mkTcTransAppCo]. Role r3 cannot be more stringent than either r1 or r2.

mkTcAxiomRuleCo :: CoAxiomRule -> [TcType] -> [TcCoercion] -> TcCoercion

mkTcPhantomCo :: TcType -> TcType -> TcCoercion

tcCoercionKind :: TcCoercion -> Pair Type

coVarsOfTcCo :: TcCoercion -> VarSet

isEqVar :: Var -> Bool

mkTcCoVarCo :: EqVar -> TcCoercion

isTcReflCo :: TcCoercion -> Bool

getTcCoVar_maybe :: TcCoercion -> Maybe CoVar

tcCoercionRole :: TcCoercion -> Role

eqVarRole :: EqVar -> Role

unwrapIP :: Type -> Coercion

Create a `Coercion` that unwraps an implicit-parameter dictionary to expose the underlying value. We expect the `Type` to have the form `IP sym ty`, return a `Coercion` `co :: IP sym ty ~ ty`.

wrapIP :: Type -> Coercion

Create a `Coercion` that wraps a value in an implicit-parameter dictionary. See `unwrapIP`.