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

Safe HaskellNone




Generic components



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

Generic function compiler and loader

loadFunType :: Name -> Q TypeSource

Extract the type of the supplied function name


data Config Source

Configuration parameters for the function loader




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]

Calling Convention

data CallConv Source

The Calling Convention specifies how a type should be converted




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 Walk the type and apply the type family to every element that is an instance of tf

expandTF :: Type -> Q TypeSource

Expand type families


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


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.


Reference Bool 
Reference Double 
Reference Float 
Reference Int8 
Reference Int16 
Reference Int32 
Reference Int64 
Reference Word8 
Reference Word16 
Reference Word32 
Reference Word64 
Storable (a, b) => Reference (a, b) 
Storable (a, b, c) => Reference (a, b, c) 
Storable (a, b, c, d) => Reference (a, b, c, d) 
Storable (a, b, c, d, e) => Reference (a, b, c, d, e) 
Storable (a, b, c, d, e, f) => Reference (a, b, c, d, e, f) 
Storable (a, b, c, d, e, f, g) => Reference (a, b, c, d, e, f, g) 

class Marshal a whereSource

Convert between Haskell and representation types

Associated Types

type Rep a :: *Source


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

from :: Rep a -> IO aSource


Marshal Bool 
Marshal Double 
Marshal Float 
Marshal Int8 
Marshal Int16 
Marshal Int32 
Marshal Int64 
Marshal Word8 
Marshal Word16 
Marshal Word32 
Marshal Word64 
(Marshal a, Marshal b) => Marshal (a, b) 
(Marshal a, Marshal b, Marshal c) => Marshal (a, b, c) 
(Marshal a, Marshal b, Marshal c, Marshal d) => Marshal (a, b, c, d) 
(Marshal a, Marshal b, Marshal c, Marshal d, Marshal e) => Marshal (a, b, c, d, e) 
(Marshal a, Marshal b, Marshal c, Marshal d, Marshal e, Marshal f) => Marshal (a, b, c, d, e, f) 
(Marshal a, Marshal b, Marshal c, Marshal d, Marshal e, Marshal f, Marshal g) => Marshal (a, b, c, d, e, f, g)