A state machine system in Scala.