[Haskell-cafe] Type safety in foreign pointer
briqueabraque at yahoo.com
Wed Oct 15 09:40:16 EDT 2008
I'm wrapping a library where functions take
as parameters pointers to a few standard
structs (as, well, all C libraries). I
would like to ensure that only pointers of
correct structs are passed to those functions.
What is the "Haskell way" to do that? My
idea is to do something like this:
newtype SomeStruct = SomeStruct ()
foreign import ccall "my_function" myfunction
:: Ptr SomeStruct -> IO int
Is that the proper way to do that?
More information about the Haskell-Cafe