Re: [Haskell-cafe] allocation for pure FFI functions

2010-10-15 Thread Duncan Coutts
On Thu, 2010-10-14 at 17:45 +, Johannes Waldmann wrote: Hi. I wonder how to do the following properly. I have one (large) C type, let's call it T, and I want to sell it as an abstract type in Haskell. I want to use C functions as if they were of type T - T (pure function, returns a

Re: [Haskell-cafe] allocation for pure FFI functions

2010-10-15 Thread Nicolas Pouillard
On Fri, 15 Oct 2010 09:07:22 +0100, Duncan Coutts duncan.cou...@googlemail.com wrote: On Thu, 2010-10-14 at 17:45 +, Johannes Waldmann wrote: Hi. I wonder how to do the following properly. I have one (large) C type, let's call it T, and I want to sell it as an abstract type in

[Haskell-cafe] allocation for pure FFI functions

2010-10-14 Thread Johannes Waldmann
Hi. I wonder how to do the following properly. I have one (large) C type, let's call it T, and I want to sell it as an abstract type in Haskell. I want to use C functions as if they were of type T - T (pure function, returns a modified copy of the input) and the question is, how to do the

Re: [Haskell-cafe] allocation for pure FFI functions

2010-10-14 Thread Edward Z. Yang
Excerpts from Johannes Waldmann's message of Thu Oct 14 13:45:46 -0400 2010: Is there a solution? Workaround? Better approach? If it boils down to unsafePerformIO, then where do I put it, and what should I watch out for? unsafePerformIO is your ticket here. The key is to ensure all of the