ghc-7.6.2: The GHC API

Safe HaskellNone

Vectorise.Generic.PADict

Synopsis

Documentation

buildPADictSource

Arguments

:: TyCon

tycon of the type being vectorised.

-> CoAxiom

Coercion between the type and its vectorised representation.

-> TyCon

PData instance tycon

-> TyCon

PDatas instance tycon

-> SumRepr

representation used for the type being vectorised.

-> VM Var

name of the top-level dictionary function.

Build the PA dictionary function for some type and hoist it to top level.

The PA dictionary holds fns that convert values to and from their vectorised representations.

Recall the definition:
    class PR (PRepr a) => PA a where
      toPRepr      :: a -> PRepr a
      fromPRepr    :: PRepr a -> a
      toArrPRepr   :: PData a -> PData (PRepr a)
      fromArrPRepr :: PData (PRepr a) -> PData a

Example:
    df :: forall a. PR (PRepr a) -> PA a -> PA (T a)
    df = /a. (c:PR (PRepr a)) (d:PA a). MkPA c ($PR_df a d) ($toPRepr a d) ... 
    $dPR_df :: forall a. PA a -> PR (PRepr (T a))
    $dPR_df = ....   
    $toRepr :: forall a. PA a -> T a -> PRepr (T a)
    $toPRepr = ...
 The ... stuff is filled in by buildPAScAndMethods