
On Wed, Jan 04, 2006 at 12:36:35PM +0000, Simon Marlow wrote:
thawNode nodePtr = do deRefStablePtr (castPtrToStablePtr nodePtr)
You're attempting to deref the StablePtr, and also run it as an IO action! I bet the original value wasn't an IO action, right?
You probably want something like
thawNode nodePtr = do node <- deRefStablePtr (castPtrToStablePtr nodePtr) -- and do something with node here
in general, try to keep as much type information as possible. That is, avoid the use of castPtrToStablePtr and its inverse, by giving correct types to your FFI functions (you haven't shown more of the code so I don't know if this applies in your case).
The code is at http://svn.openfoundry.org/pugs/src/Data/Yaml/Syck.hsc .
parseYaml works, as does its usage of freezeNode. readNode is slightly
different than thawNode; it gets its pointer from an out variable in
syck_lookup_sym.
Note that readNode also returns an IO YamlNode. How is it correct to do
so there?
--
Gaal Yahas