multiple pure functional states

In the last post I used a really simple example to explore the management and passage of state from one function to another following an example from Functional Programming in Scala. This worked well,┬áthere was a nice simple API and the mantra of “follow the types” seemed like it was helping. Then I tried to experiment with managing two states of different types where one would depend on the other for it’s implementation. I quickly figured out how not to do it, so there must be a pattern.

Below is probably how not to do it…

Error is the price we pay for progress.

Next time a more elegant solution.. for now this quote will have to suffice.