
15 Oct
2008
15 Oct
'08
9:40 a.m.
Hi, 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 () and then foreign import ccall "my_function" myfunction :: Ptr SomeStruct -> IO int Is that the proper way to do that? Thanks, MaurĂcio