Speaker Deck

Playing with Graphics and Animations in Haskell

by Manuel Chakravarty

Published August 29, 2016 in Programming

TALK VIDEO: https://www.youtube.com/watch?v=9dk7_GDNocQ (some code is hard to read in the video, you may like to refer to these slides for that)

NB: The talk includes live coding. In this version of the slides, these sections have been replaced by links to screencasts of the live coding sessions on Vimeo as Speaker Deck does not support embedded video.

Graphics and animations are not only fun, they are also an effective learning tool. For example, fractal tree structures nicely illustrate recursion, and animations are often more motivating and engaging than examples and exercises spewing out text. In this talk, I will demonstrate graphics and animations in Haskell playgrounds — aka the REPL on steroids. The immediate feedback of playgrounds facilitates an explorative style of programming that is especially attractive for graphics programming.

Graphics, animation, and games programming in Haskell faces a dilemma. We can either use existing frameworks with their highly imperative APIs or we waste a lot of energy trying to re-engineer those rather complex systems from scratch. Or, maybe, we can escape the dilemma. Instead of a Haskell program directly manipulating the mutable object-graph of existing frameworks, we provide an API for purely functional transformations of a Haskell data structure, together with an adaptation layer that transcribes those transformations into edits of the mutable object-graph. I will illustrate this approach by describing the architecture of a Haskell binding to the animation system of Apple’s SpriteKit framework.

This talk was the opening keynote of Compose :: Melbourne: http://www.composeconference.org/2016-melbourne/day-one-program/

The code of the Lazy Lambda game is open source at https://github.com/mchakravarty/lazy-lambda and the code for the Haskell SpriteKit binding is at https://github.com/mchakravarty/HaskellSpriteKit