ghc-7.4.2: The GHC API

Safe HaskellNone

Vectorise.Generic.PADict

Synopsis

Documentation

buildPADictSource

Arguments

:: TyCon

tycon of the type being vectorised.

-> TyCon

tycon of the type used for the 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 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. PA a -> PA (T a)
    df = /a. (d:PA a). MkPA ($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