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

Safe HaskellNone
LanguageHaskell2010

System.Plugins.MultiStage

Contents

Description

Generic components

Synopsis

Loading

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

Generic function compiler and loader

loadFunType :: Name -> Q Type Source

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 Type Source

Convert a type using the supplied calling convention

applyTF :: Name -> Type -> Q Type Source

Apply a type family

expandTF :: Type -> Q Type Source

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 a Source

Unpack a value from its runtime representation

unpack a = deref a >>= from

class Reference a where Source

Optionally make a refrence of a value

Minimal complete definition

Nothing

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 a Source

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

class Marshal a where Source

Convert between Haskell and representation types

Minimal complete definition

Nothing

Associated Types

type Rep a :: * Source

Methods

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

from :: Rep a -> IO a Source