[Haskell-beginners] Ffi, memory allocation and failure
C Gosch
ch.gosch at googlemail.com
Wed Feb 9 15:57:32 CET 2011
Hi Edward, hello to all list members,
thank you for your comments, I will keep that in mind. There will be
operations on matrices (and other objects) which modify the objects,
and those will be in IO or ST, I think.
However, I am planning to provide operations with matrices which guarantee
that each involved matrix is not changed, but which may return new matrices.
All matrices have to be allocated, and that allocation can fail ... how does
one usually go about this problem in Haskell?
Cheers,
Christian
2011/2/9 Edward Z. Yang <ezyang at mit.edu>
> 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).
>
> Edward
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110209/000cce8f/attachment.htm>
More information about the Beginners
mailing list