createExecutor :: ToExecutor a => a -> IO Executor
createExecutor c = do
  registeredFun <- wrapExecutorRegistered $ \edp eip fip sip -> runManaged $ do
    ei <- unmarshal eip
    fi <- unmarshal fip
    si <- unmarshal sip
    liftIO $ registered c (ExecutorDriver edp) ei fi si
  reRegisteredFun <- wrapExecutorReRegistered $ \edp sip -> runManaged $ do
    si <- unmarshal sip
    liftIO $ reRegistered c (ExecutorDriver edp) si
  disconnectedFun <- wrapExecutorDisconnected $ \edp -> disconnected c (ExecutorDriver edp)
  launchTaskFun <- wrapExecutorLaunchTask $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ launchTask c (ExecutorDriver edp) ti
  taskKilledFun <- wrapExecutorTaskKilled $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ taskKilled c (ExecutorDriver edp) ti
  frameworkMessageFun <- wrapExecutorFrameworkMessage $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    frameworkMessage c (ExecutorDriver edp) bs
  shutdownFun <- wrapExecutorShutdown $ \edp -> shutdown c (ExecutorDriver edp)
  errorCallback <- wrapExecutorError $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    errorMessage c (ExecutorDriver edp) bs
  e <- c_createExecutor registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback
  return $ Executor e registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback
createExecutor :: ToExecutor a => a -> IO Executor
createExecutor c = do
  registeredFun <- wrapExecutorRegistered $ \edp eip fip sip -> runManaged $ do
    ei <- unmarshal eip
    fi <- unmarshal fip
    si <- unmarshal sip
    liftIO $ registered c (ExecutorDriver edp) ei fi si
  reRegisteredFun <- wrapExecutorReRegistered $ \edp sip -> runManaged $ do
    si <- unmarshal sip
    liftIO $ reRegistered c (ExecutorDriver edp) si
  disconnectedFun <- wrapExecutorDisconnected $ \edp -> disconnected c (ExecutorDriver edp)
  launchTaskFun <- wrapExecutorLaunchTask $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ launchTask c (ExecutorDriver edp) ti
  taskKilledFun <- wrapExecutorTaskKilled $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ taskKilled c (ExecutorDriver edp) ti
  frameworkMessageFun <- wrapExecutorFrameworkMessage $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    frameworkMessage c (ExecutorDriver edp) bs
  shutdownFun <- wrapExecutorShutdown $ \edp -> shutdown c (ExecutorDriver edp)
  errorCallback <- wrapExecutorError $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    errorMessage c (ExecutorDriver edp) bs
  e <- c_createExecutor registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback
  return $ Executor e registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback
createExecutor c = do
  registeredFun <- wrapExecutorRegistered $ \edp eip fip sip -> runManaged $ do
    ei <- unmarshal eip
    fi <- unmarshal fip
    si <- unmarshal sip
    liftIO $ registered c (ExecutorDriver edp) ei fi si
  reRegisteredFun <- wrapExecutorReRegistered $ \edp sip -> runManaged $ do
    si <- unmarshal sip
    liftIO $ reRegistered c (ExecutorDriver edp) si
  disconnectedFun <- wrapExecutorDisconnected $ \edp -> disconnected c (ExecutorDriver edp)
  launchTaskFun <- wrapExecutorLaunchTask $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ launchTask c (ExecutorDriver edp) ti
  taskKilledFun <- wrapExecutorTaskKilled $ \edp tip -> runManaged $ do
    ti <- unmarshal tip
    liftIO $ taskKilled c (ExecutorDriver edp) ti
  frameworkMessageFun <- wrapExecutorFrameworkMessage $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    frameworkMessage c (ExecutorDriver edp) bs
  shutdownFun <- wrapExecutorShutdown $ \edp -> shutdown c (ExecutorDriver edp)
  errorCallback <- wrapExecutorError $ \edp mcp mlp -> do
    bs <- packCStringLen (mcp, fromIntegral mlp)
    errorMessage c (ExecutorDriver edp) bs
  e <- c_createExecutor registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback
  return $ Executor e registeredFun reRegisteredFun disconnectedFun launchTaskFun taskKilledFun frameworkMessageFun shutdownFun errorCallback