I have the following problem with the current design:
It assumes that type of dirty un-validatied input ~~ the type of clean validated output:
validation turns Subject into a Valid Subject.
This doesn't play well with custom types that make invalid state non-representable, e.g. Email
I want to turn String into Email (not to Valid String)
Which actually makes it a parsing, not validation.
"Parse, don't validate!" is well explained here:
https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
I have the following problem with the current design:
It assumes that type of dirty un-validatied input ~~ the type of clean validated output:
validation turns
Subjectinto aValid Subject.This doesn't play well with custom types that make invalid state non-representable, e.g.
EmailI want to turn
StringintoEmail(not toValid String)Which actually makes it a parsing, not validation.
"Parse, don't validate!" is well explained here:
https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/