What are you trying to do? (1) Call a foreign function from inside an STM transaction?
If the function is pure, this is trivial, just declare it as a pure function in the foreign import statement. You do need to be a bit careful, however, as it is possible the function will get called with invalid arguments, and I believe that GHC won't interrupt a thread inside of a foreign function call. So you need to make sure that the function never fails to terminate, even when given bad input. (There's an example code being called with improper arguments in Simon's STM paper). If the function isn't pure, you need to do a lot more proofs to assure that this is safe. In particular, the function must be able to be called with invalid input. If you are confident that this is the case, you can use unsafeIOToSTM to convert a call to that function into an STM primitive. (2) Have a foreign function use transactional memory primitives? I'm not sure that this is possible. (3) something else? -- ryan On Mon, Sep 8, 2008 at 2:56 PM, Mauricio <[EMAIL PROTECTED]> wrote: > Hi, > > Is it possible to use foreign function > interface with STMs? If so, where can I > find examples? > > Thanks, > MaurĂcio > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe