Re:Parsix: Parse Don't Validate
by araknafobia on Saturday May 15, 2021 @07:40PM
(#27169951)
What forces you to use validator function and not just do Email(input)? This is how you actually do it in Scala if anyone interested https://github.com/fthomas/refined
[ Parent
| on HN ]
Yeah, refined types are a great solution to this problem, but can lead to slow compile times. Just having private constructor for a case class and a public apply method that is an Option or Either or something can go a long way in my experience.