Popularity
1.3
Stable
Activity
0.0
Stable
1
1
0
Monthly Downloads: 7
Programming language: Haskell
License: Mozilla Public License 2.0
Tags:
Foreign
Latest version: v0.2.0.0
marshal-contt alternatives and similar packages
Based on the "Foreign" category.
Alternatively, view marshal-contt alternatives based on common mentions on social networks and blogs.
-
tasty-lua
DISCONTINUED. Integrate Lua tests into tasty. This package is now part of the hslua monorepo. -
hslua-module-text
DISCONTINUED. Lua module providing a selected set of operations on Text. NOTE: moved into the hslua monorepo. -
hslua-module-system
DISCONTINUED. HsLua module for system and directory functions. This repository has been moved to the hslua monorepo. -
foreign-storable-asymmetric
DISCONTINUED. Types and instances for implementing a Storable with different peek and poke
AppSignal - Monitoring that respects your time & budget
APM, error tracking, and dashboards for modern web apps. Ten-minute setup, transparent flat pricing, and support from engineers who actually use the product.
Promo
www.appsignal.com
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of marshal-contt or a related project?
README
marshal-contt
A ContT-based wrapper for the bracket-style Haskell-to-C marshalling functions in base and bytestring.
Example:
type Argv = [BS.ByteString]
type Env = M.Map BS.ByteString BS.ByteString
allocStringArrayWith :: [BS.ByteString] -> ContT r IO (Ptr CString)
allocStringArrayWith = allocaArrayWith0' withCString
allocStringMapWith :: M.Map BS.ByteString BS.ByteString -> (Ptr CString -> IO a) -> IO a
allocStringMapWith = iallocaArrayWith0' (\(k, v) -> withCString $ k <> "=" <> v)
spawn :: FilePath -> [FileActions] -> Argv -> Env -> IO ProcessID
spawn path actions argv env = flip runContT return $ do
cPath <- withCString path
cAction <- withFileActions actions
cArgv <- allocStringArrayWith argv
cEnv <- marshalEnv env
pidPtr <- alloca
liftIO . throwErrnoIf_ (/= 0) path $
posix_spawn pidPtr cPath cActions nullSpawnAttrs cArgv cEnv
liftIO $ peek pidPtr
spawnp :: String -> [FileActions] -> Argv -> Env -> IO ProcessID
spawnp command actions argv env = flip runContT return $ do
cPath <- withCString path
cAction <- withFileActions actions
cArgv <- allocStringArrayWith argv
cEnv <- marshalEnv env
pidPtr <- alloca
liftIO . throwErrnoIf_ (/= 0) path $
posix_spawnp pidPtr cPath cActions nullSpawnAttrs cArgv cEnv
liftIO $ peek pidPtr