News for hackers. Stuff that matters.
Re:Types as Interfaces by oasisaimlessly on Tuesday July 23, 2024 @01:44PM (#41048783)
AKA the "parse, don't validate" approach [1].

1: https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

Re:Types as Interfaces by bombela on Tuesday July 23, 2024 @03:04PM (#41049603)
The salient excerpt is: "A parser is just a function that consumes less-structured input and produces more-structured output". In opposition to a validation function that merely raises an error.

    - validate(raw) -> void
    - parse(raw) -> Email | Error
Of course the type signature is what seals the deal at the end of the day. But I am going to follow this naming convention from now on.