| So, how about the following? Instead of the | | newtype Window = Window ForeignObj | | way of wrapping foreign ADTs that we used so far, should we | use | | newtype WindowTag = WindowTag () | type Window = ForeignObj WindowTag A fine idea. I accept what you say about ADTs, but if it's really so, we woudn't need the objectionable
withForeignObj :: ForeignObj -> (Ptr a -> IO b) -> IO b
because all ForeignObj-manipulating things would be foreign imported foreign import f :: Window -> IO () Anyway, it strikes me as good to tag each ForeignObj with an indication of what it points to, just so that one does not mix up ForeignObjs that should not be mixed. But it's just a suggestion. You guys who are deeply into the FFI should decide. It would be nice to get to closure on this FFI stuff -- it's been going on a long time! Simon