
This might seem like a strange thing to do, but ...
Presume I have a HaskellObj in some C code. I know that it is a thunk. I want to force it to _WHNF_ .
Should/can I use rts_eval()?
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.
Or perhaps there is another/better way.
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).
A lightweight solution would be nice.
rts_eval() is the right way to do it, but it isn't particularly lightweight: it creates a new thread to do the evaluation. I imagine you could have a special-purpose thread that you keep around purely for doing these evaluations, if efficiency is important to you. Cheers, Simon