forcing a haskell object to WHNF from C

Wolfgang Thaller wolfgang.thaller@gmx.net
Wed, 29 Jan 2003 16:33:59 +0100


> Should/can I use rts_eval()?

Yes.

> Any pointers on what this does (start new threads, cause garbage 
> collection
> ...) would be appreciated. I can (and have) gone over the code but a 
> more
> high level description would be helpful.

rts_eval() may cause garbage collection to happen. This means that 
every HaskellObj value might be invalid after a call to rts_eval 
(except for the return value).
rts_eval starts a new concurrent Haskell thread to do the evaluation.

> In essence I want a C version of seq (perhaps I can call to Haskell to
> perform a seq on it, but I think this might be overkill).

Calls to Haskell are implemented using rts_eval/rts_evalIO too, so 
writing it in Haskell is the same thing with a little bit more overhead.

Cheers,

Wolfgang