cplug-0.2.0.0: Recompile and run partially applied C functions in Haskell, during runtime

Safe HaskellNone
LanguageHaskell2010

HSGen.FFI

Synopsis

Documentation

pragma :: Text Source

This is the standard language pragma for Haskell FFI

typesImport :: [Text] -> Text Source

This generates the import line for Foreign.C.Types

ioifyUnit :: Text -> Text Source

Example:

>>> ioifyUnit (T.pack "Bool")
"IO (Bool)"

fixUnit :: Text -> Text Source

Example:

>>> fixUnit (T.pack "String")
"Fix (String)"

ioifyTypeList :: [Text] -> [Text] Source

Example:

>>> ioifyTypeList . map T.pack ["Bool", "String", "Int"]
["Bool", "String", "IO (Int)"]

fixInit :: [Text] -> Text Source

Example:

>>> fixInit . map T.pack $ ["a", "b", "c"]
"Fix (a) -> Fix (b)"

wrapperLast :: [Text] -> Text Source

Example:

>>> wrapperLast . map T.pack $ ["a", "b", "c"]
"Wrapper (FunPtr (a -> b -> c) (c))"

fixTypeList :: [Text] -> Text Source

Example:

>>> fixTypeList (T.pack "a -> b -> c")
"Fix (a) -> Fix (b) -> Wrapper (FunPtr (a -> b -> c)) c"

functionImport :: Text -> Text -> Text -> Text Source

Example:

>>> functionImport (T.pack "math.h") (T.pack "sin") (T.pack "CDouble -> CDouble")
"foreign import ccall \"math.h sin\" c_sin :: CDouble -> CDouble \n"

defUnfix :: Default a => Fix a -> a Source

mkBoolToCUInt :: Int -> Text Source

Warning: This (generated) function needs a specific type declaration, don't forget to implement!