Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Parse, Don't Validate (lexi-lambda.github.io)
31 points by phonebucket on Nov 7, 2019 | hide | past | favorite | 4 comments


To me, this is the highlight of this post:

  Consider: what is a parser? Really, a parser is just a 
  function that consumes less-structured input and 
  produces more-structured output. By its very nature, a 
  parser is a partial function—some values in the domain 
  do not correspond to any value in the range—so all 
  parsers must have some notion of failure. Often, the 
  input to a parser is text, but this is by no means a 
  requirement (...)
Then, the title of the post could be: Leverage the type system to represent your data, not validating it post-facto


Or, "make invalid state unrepresentable".



Yes that's better




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: