Run free with the monads: Free Monads for fun and profit
Free monads are a powerful technique that among other things, can separate the pure representation of code from its interpretation. The representation can be as sophisticated as any imperative program, but totally pure and typesafe! Not only this; once the concepts are understood, applying them is child’s play.
Here we provide an overview of the technique, and show how it can be used to write the AI scripts of a simple tank game in a totally pure and declarative way.