[Haskell-beginners] Ffi, memory allocation and failure

Edward Z. Yang ezyang at MIT.EDU
Wed Feb 9 14:44:47 CET 2011

Hello Christian,

Assuming that the foreign library is based off of mutation on matrices,
there's not an easy way to export a nice pure interface to them, because
they're not actually persistent: if another thread goes and modifies
some pointer which you also have in pure code, referential transparency
is broken.  So you'll have to think carefully about what sorts of guarantees
you can (or want) to make to Haskell, and if you can't fulfill them, keep
the code in IO (or create your own monad for manipulating matrices).


More information about the Beginners mailing list