
Hi Esa! Thanks for the very detailed and clear explanation! I was going to wait till I'd implemented a simple example of passing/calling a function closure to post a reply but I've wasted all day just trying to think up a good name for my graphics library! :-) Regarding DirectX bindings, if you've not already done so you may be interested to see how the DirectX9 .NET api is structured. Certainly when I wrote a small graphics program in C# a year or so ago I was quite impressed by the way the DX9.NET api managed to hide a lot of the mess that you have to deal with in the C/C++ api such as keeping track of resources that suddenly disappear and dealing with reset properly. It looks like I won't need to go to such a low level though for my api - I imagine my call back functions will be implemented easily by using a FunPtr to something which returns a suitable monadic type which will keep track of the state of the app's 'document' and be combined with the IO monad in some way. Also thanks for pointing out the existence of the Win32 bindings. Also I noticed that a Haskell version of the ObjectIO library was hiding in my GHC installation too, so this will be a further useful source of ideas for how to structure my api. Best regards, Brian.