Ken Scambler (@KenScambler) in this talk deftly takes us through how we can effectively separate concerns within our software. This is an essential feature of being able to write code that can be reasoned about locally, and hence easier to maintain.
The technique is to use
Free monads allow you to separate the definition of your programme from the running of it. In this talk Ken demonstrates a tank game that has a defined script but different AIs that can be applied later through the use of swappable interpreters.
The key to the free monad is to have a side-effect Free “Fantasy” DSL that describes your concerns and an Interpreter which executes the effects. The Free monad lifts your DSL (which is a functor) into monad.
Ken is also available for Weddings and Children’s parties.
You can find the talk on YouTube.