given another chance, I’d like to try my hand at modeling the state transitions as a DSL inside the Free monad.
Seems like there’s a fairly clear migration path there - start by turning those four functions into values and moving their bodies into the interpreter, then gradually decompose each into smaller primitives.
Agreed. Keeping the top-level Model.Game.updateGame, function – but internally running an interpreter – looks to be the lowest-hanging fruit. Decomposing the various transitions with lenses is also an approach that might be worthwhile.
What I’m hoping for, though, is to be able to move out the entire game step, including capturing user input, into a DSL of its own. My understanding is that this is where the benefits of the Free monad pay off. I’ll try to tackle that next, time permitting.
Whether you get to this or not – good work and explanation. Appreciate the writeup.