How newStablePtr return un-packable IO ()?
Hi, jhc hackers.
Now, I am trying create forkOS with pthread.
But StablePtr error stops it.
Jhc's newStablePtr cannot pack IO () for running with unpack.
$ cat Main.hs
import Foreign.StablePtr
main :: IO ()
main = do
p <- newStablePtr $ print "hoge"
d <- deRefStablePtr p
d
casper$ ajhc Main.hs
ajhc Main.hs
ajhc 0.8.0.5 (b6d58e95e63be9848f267e9242dedff5e5f7b25b)
Finding Dependencies...
Using Ho Cache: '/home/kiwamu/.ajhc/cache'
Main [Main.hs] <~/.ajhc/cache/c41ljd5d48u6h86r9ap27k0vq2.ho>
Fresh: <~/.ajhc/cache/c41ljd5d48u6h86r9ap27k0vq2.ho>
Typechecking...
Compiling...
Collected Compilation...
-- TypeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
-- LambdaLift
Converting to Grin...
Updatable CAFS: 0
Constant CAFS: 0
Recursive CAFS: 0
ajhc: Grin.FromE.compile'.ce in function: theMain
can't grok expression:
Hi.
On Wed, Jun 5, 2013 at 1:59 PM, Kiwamu Okabe
Now, I am trying create forkOS with pthread. But StablePtr error stops it. Jhc's newStablePtr cannot pack IO () for running with unpack.
This is small library for forkOS. https://github.com/ajhc/ajhc-dumpyard/tree/master/try_pthread2 But forkOS API is different from GHC's.
forkOS :: FunPtr (Ptr () -> IO (Ptr ())) -> IO ThreadId
I would like to convert any IO () to FunPtr (IO ()). Of course, GHC has foreign import ccall “wrapper”, but jhc not. No idea in me....... Regards, -- Kiwamu Okabe
participants (1)
-
Kiwamu Okabe