4 ms·
You can think of the parser as containing validation logic — it can parse the value into a more constrained type if it conforms to validation rules, or it can f
by yakshaving_jgt 5y ago
You can think of the parser as containing validation logic — it can parse the value into a more constrained type if it conforms to validation rules, or it can fail.
The point is that once your value is in a more principled type, the rest of the system is free from having to make assumptions (and guard against potential failures) about the breadth of that value's domain.
As the article mentions, this is really only relevant to languages with proper type systems like Haskell.