Vectorise.Utils.PADict

ghc-7.10.3: The GHC API

Safe Haskell | None
Language | Haskell2010

Vectorise.Utils.PADict

Synopsis

- paDictArgType :: TyVar -> VM (Maybe Type)
- paDictOfType :: Type -> VM CoreExpr
- paMethod :: (Builtins -> Var) -> (TyCon -> Builtins -> Var) -> Type -> VM CoreExpr
- prDictOfReprType :: Type -> VM CoreExpr
- prDictOfPReprInstTyCon :: Type -> CoAxiom Unbranched -> [Type] -> VM CoreExpr

# Documentation

paDictArgType :: TyVar -> VM (Maybe Type)

Construct the PA argument type for the tyvar. For the tyvar (v :: *) it's just PA v. For (v :: (* -> *) -> *) it's

    forall (a :: * -> *). (forall (b :: *). PA b -> PA (a b)) -> PA (v a)

paDictOfType :: Type -> VM CoreExpr

Get the PA dictionary for some type

paMethod :: (Builtins -> Var) -> (TyCon -> Builtins -> Var) -> Type -> VM CoreExpr

Produce code that refers to a method of the `PA` class.

prDictOfReprType :: Type -> VM CoreExpr

Get the PR dictionary for a type. The argument must be a representation type.

prDictOfPReprInstTyCon :: Type -> CoAxiom Unbranched -> [Type] -> VM CoreExpr

Given a type `ty`, its PRepr synonym tycon and its type arguments, return the PR `PRepr ty`. Suppose we have:

    type instance PRepr (T a1 ... an) = t

which is internally translated into

    type :R:PRepr a1 ... an = t

and the corresponding coercion. Then,

    prDictOfPReprInstTyCon (T a1 ... an) :R:PRepr u1 ... un = PR (T u1 ... un)

Note that `ty` is only used for error messages