Design for errors - An introduction to Domain Modeling with Arrow
summary
Kotlin code demonstrates domain types instead of raw strings: value classes and private smart constructors validate names and emails at creation, and Arrow refined types save boilerplate. Network calls return an explicit error/success union using Either.bind to write sequential code without nesting, turning exceptions into typed failures. Examples include phone, postal and non-empty contact lists enforced by NonEmptyList, and a real-world cautionary story about defaulting nullable DOBs that led to account takeover. Overall the examples compile-time enforce constraints and reduce runtime surprises.
AI-written summary · about
chapters (9)
- 0:00Introduction and motivation
- 6:28Domain modeling basics
- 10:51Refining types with Arrow
- 15:12Avoiding default values
- 21:40Modeling verified emails
- 27:50Classifying errors
- 31:05Railway oriented programming
- 35:41Using Either for error handling
- 39:18Future-proofing domain models
related talks
46mDesign for errors - An introduction to Domain Modeling with a bit of Arrow
40mArrow of Outrageous Error Handling
41mAn Arrow to the Kotlin
32mFrom Exception Hell to Typed Bliss: Real-World Error Handling with Kotlin and Arrow
47mFunctional programming in Kotlin: exploring Arrow
44mError Handling Beyond the Standard Library
30mFunctional programming in Kotlin: exploring Arrow
54mFunctional Web APis in Practice
