[Haskell-cafe] Packed String parameters

Bulat Ziganshin bulatz at HotPOP.com
Thu Jan 19 18:57:33 EST 2006


Hello Chad,

Thursday, January 19, 2006, 9:52:59 PM, you wrote:

SC> Thanks, Bulat. Taking a look at Hal's FastIO library now...

SC> Hal, it looks like your library could be helpful, especially if there is
SC> a way to construct a FastIO.Handle from stdin. Can this be done, or do I
SC> need to start with an actual file?

add the following to fastio.c:

void* openStdin()
{
  return stdin;
}


and this to FastIO.hs:

openStdin :: IO Handle
openStdin = do
  h   <- c__openStdin
  return (H h)

foreign import ccall "openStdin"  c__openStdin :: IO (Ptr ())


btw, id this is a test for shootout - is using C code acceptable? this
way you can rewrite the whole program :)

-- 
Best regards,
 Bulat                            mailto:bulatz at HotPOP.com





More information about the Haskell-Cafe mailing list