[Haskell-beginners] FFI for more object oriented structure

Nathan Hüsken nathan.huesken at posteo.de
Sat Dec 15 14:23:03 CET 2012


Hey,

I am trying to write FFI bindings for cocos2d-html5 (with haste).
In cocos2d-x html5 one defines a main scene containing a "onEnter" 
functions which initilizes the scene.
The application is then started with:

var myApp = new cocos2dApp(MainScene);

which calls "MainScene.onEnter" in the correct moment.

Now I wonder what be the best way to map this to Haskell.
I could define

newScene :: IO () -> IO Scene

which takes the onEnter functions as argument.

I do not know, my haskell experience is not very well founded.
What do think about this approach? Can you think of a more haskellish 
approach?

Thank you!
Nathan



More information about the Beginners mailing list