Wrapping Up
In this chapter, we learned how to model a workflow using only types.
We started by documenting the inputs to the workflow, and in particular, how to model commands. We then looked at how we could use state machines to model documents and other entities with life cycles. With our new understanding of states, we went back to the workflow, modeling each substep using types to represent the input and output states, and we also went to some effort to document the dependencies and effects of each step.
Along the way we created what seems like hundreds of types (actually only about thirty). Was this really necessary? Is this too many types? It might seem like a lot, but remember that we are trying to create executable documentation—code ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access