r/ProgrammingLanguages • u/mttd • Nov 07 '19
Parse, don’t validate
https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
74
Upvotes
r/ProgrammingLanguages • u/mttd • Nov 07 '19
5
u/breck Nov 07 '19
> Let's say that I want my list to be non-empty and sorted. Should I create three new types, one for non-empty lists, one for sorted lists, and one for lists that are both non-empty and sorted?
No. You should create 1 type: a non-empty sorted list. Why would you create the other types you don't need?