MicroHs-0.17.4.0 / tests / ApplySP.hs
module ApplySP whereimport Foreignimport Foreign.C.Stringforeign import ccall "hsasp.h hsasp" asp :: StablePtr (CString -> IO CString) -> IO ()fcn :: CString -> IO CStringfcn cs = do s <- peekCString cs putStrLn $ "fcn: " ++ show s newCString "done"main :: IO ()main = do sp <- newStablePtr fcn asp sp