[jhc] darcs patch: try to abstract IO a bit
David Roundy
droundy at darcs.net
Sat Sep 5 10:54:41 EDT 2009
Hi John,
This is an attempt to move towards the point where I could try
implementing concurrent IO. I am not sure whether this approach will
work at all, so I'll appreciate your feedback. I'll probably send a
separate email with more details on what I'm thinking.
This patch is essentially a cleanup, which moves the newtype of IO
into Jhc.IO and avoids exporting its constructor. The hope is that
I can later change the type of IO, perhaps to something like
newtype OldIO a = IO (World__ -> (# World__, a #))
newtype IO a =
IO { runIO :: (a -> ThreadState -> OldIO ()) -- ^ a continuation
-> ThreadState -- ^ the current state
-> OldIO () } -- ^ the combined computation
although I'd also want to figure out how to work exceptions into the
picture.
Anyhow, I think this patch is reasonable on its own. My greatest
uncertainty at the moment due to my lack of understanding of how you
deal with FFI calls. i.e. how is the code for a delcaration like
foreign import ccall "stdio.h jhc_utf8_putc" c_putc :: Ptr CFile -> Int -> IO ()
generated? I imagine that some work will have to happen in the core
compiler in order for this import to generate a call to Jhc.IO.io
(which is what I'd like).
That's all for now... I'm off to have brunch. :)
David
Sat Sep 5 10:45:15 EDT 2009 David Roundy <droundy at darcs.net>
* try to abstract IO a bit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 12325 bytes
Desc: A darcs patch for your repository!
Url : http://www.haskell.org/pipermail/jhc/attachments/20090905/45cae3a5/attachment.bin
More information about the jhc
mailing list