Easy and Efficient Data Validation with Cats
summary
Compares Option and Either failure modes and shows Cats’ ValidatedNel as the practical solution for form validation by accumulating errors instead of failing fast; implements email/phone validators, combines them with the mapN/pizza symbol (apply) so all field errors return together, and uses a Semigroup (list/not-empty-list) to merge errors and force at least one message. Provides companion helpers (validateSuccess/Failure, accumulate) and working code on GitHub used successfully on multi-field forms.
AI-written summary · about
chapters (12)
- 0:00Start
- 2:20DATA VALIDATION
- 6:22CASE STUDY
- 7:23OPTION
- 10:50EITHER (2.11)
- 15:21EITHER (2.12)
- 21:10VALIDATED AND APPLY
- 28:27USE AN EXPRESSIVE ERROR TYPE
- 28:53OUR FINAL SOLUTION
- 31:02STEP 1
- 32:27A CONCRETE EXAMPLE
- 34:27SUMMARY
related talks
27mUsing Monads for Elegant Error Handling
23mForm Validations with VEST
30mForm Validations Do Not Have To Suck. Introducing Vest!
31mProgramming Safely in an Uncertain World
22mYou and your type[s] aren't welcome here
44mInitiatory Journey from Exceptions to Composable Error Types
28mExplicit Elixir
01h 33mPrinciples for Modular, Functional, Approachable Libraries
