In Haskell and many other functional languages, graphics libraries, animation frameworks, game engines, and the like usually have to choose between providing either state-of-the-art functionality or a purely functional API. In this paper, we will show that we can layer a purely functional interface on top of an object-oriented, imperative one in an efficient manner. We do so by computing the difference between the input and output values of purely functional transformation functions, and then, applying that difference to a mutable object graph. We will make good use of Haskell's by-default lazy evaluation in realising this scheme.
To demonstrate the feasibility of this approach, we implemented a Haskell binding to the SpriteKit animation system and game engine. We describe its interface, how to use it, and the methods underlying its implementation.
PDF (12 pages)
This page is part of Manuel Chakravarty's WWW-stuff.