I have a C function whose behaviour is customized by user-supplied function (think of libc qsort). Typically these user-supplied functions are written in C, but I'd like to use FFI to write them in Haskell. Precisely, I'd like to write high-order function which will generate these functions (e.g. mkCompare :: ... -> (Ptr a -> Ptr a -> Int) for feeding the result to qsort).
As I understand, there are two ways to do that. Either Haskell code is called from C, or C code is called for Haskell. So my questions are: 1. Are they both possible? 2. If yes, which is better performance-wise? (C function is performance-critical). If generated function is called many times, how big an overhead is going to be? -- Roman I. Cheplyaka :: http://ro-che.info/ kzm: My program contains a bug. How ungrateful, after all I've done for it. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe