[Haskell-cafe] Please review my Xapian foreign function interface

Edward Z. Yang ezyang at MIT.EDU
Mon Feb 21 02:49:49 CET 2011

Thanks Oliver!

I haven't had time to look at your bindings very closely, but I do
have a few initial things to think about:

    * You're writing your imports by hand.  Several other projects used
      to do this, and it's a pain in the neck when you have hundreds
      of functions that you need to bind and you don't quite do it all
      properly, and then you segfault because there was an API mismatch.
      Consider using a tool like c2hs which rules out this possibility
      (and reduces the code you need to write!)

    * I see a lot of unsafePerformIO and no consideration for:
        - Interruptibility
        - Thread safety
      People who use Haskell tend to expect their code to be thread-safe and
      interruptible, so we have high standards ;-) But even C++ code
      that looks thread safe may be mutating shared memory under the hood,
      so check carefully.

I use Sup, so I deal with Xapian on a day-to-day basis. Bindings are good
to see.


More information about the Haskell-Cafe mailing list