7900 shaares
161 private links
161 private links
Parsing increases the information in the type system. A list can be of type NonEmpty, i.e. there is at least one element.
Use a data structure that makes illegal states unrepresentable.
Push the burden of proof upward as far as possible, but no further.
and awesome guidelines to follow.
So parse "data" and return the closest type instead of only validate them.