Parse, don't validate (2019)
Note that this basically requires your language to have ergonomic support for sum types, immutable &quot;data classes&quot;, pattern matching.<p>The point is to parse the input into a structure which always upholds the predicates you care about so you don&#x27;t end up continuously defensively programming in ifs and asserts.