plugins-multistage-0.5: Dynamic linking for embedded DSLs with staged compilation

Safe HaskellNone

System.Plugins.MultiStage

Contents

Description

Generic components

Synopsis

Loading

loadFunWithConfig :: Config -> [Name] -> Q [Dec]Source

Generic function compiler and loader

loadFunType :: Name -> Q TypeSource

Extract the type of the supplied function name

Configuration

data Config Source

Configuration parameters for the function loader

Constructors

Config 

Fields

declWorker :: Config -> Name -> Name -> [Name] -> Type -> [DecQ]
 
builder :: Config -> Name -> Q Body
 
worker :: Name -> [Name] -> Q Body
 
typeFromName :: Name -> Q Type
 
mkHSig :: Type -> Q Type
 
mkCSig :: Type -> Q Type
 
prefix :: String
 
wdir :: String
 
opts :: [String]
 
safety :: Safety
 

Calling Convention

data CallConv Source

The Calling Convention specifies how a type should be converted

Constructors

CallConv 

Fields

arg :: Type -> Q Type

Convert an argument

res :: Type -> Q Type

Convert the result

buildType :: CallConv -> Type -> Q TypeSource

Convert a type using the supplied calling convention

applyTF :: Name -> Type -> Q TypeSource

Apply a type family

expandTF :: Type -> Q TypeSource

Expand type families

Marshaling

pack :: (Reference (Rep a), Marshal a) => a -> IO (Ref (Rep a))Source

Pack a value into its runtime representation

 pack a = to a >>= ref

unpack :: (Reference (Rep a), Marshal a) => Ref (Rep a) -> IO aSource

Unpack a value from its runtime representation

 unpack a = deref a >>= from

class Reference a whereSource

Optionally make a refrence of a value

Associated Types

type Ref a :: *Source

The type of a referenced value

Methods

ref :: a -> IO (Ref a)Source

Convert to a referenced value

deref :: Ref a -> IO aSource

Convert from a referenced value In the IO monad to allow peeking through the reference.

class Marshal a whereSource

Convert between Haskell and representation types

Associated Types

type Rep a :: *Source

Methods

to :: a -> IO (Rep a)Source

from :: Rep a -> IO aSource