Refined types for validated configurations
summary
Live-coding shows actual code: use PureConfig to eliminate boilerplate, attach refined types for predicates (nonEmpty, Positive, port > 1023) so invalid values fail at load time, and even write an impure predicate that binds a socket to check an open port. A small library called series demonstrates keeping most config in Scala, loading only secrets from environment, accumulating errors like Validated and integrating with shapeless and squants so validated, type-level configs load without ad hoc checks.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 0:50Overview
- 1:55Use cases
- 4:15Typesafe
- 6:05Validation
- 8:08Refined
- 10:48Refined settings
- 11:55Open port validation
- 14:02Configuration files
- 15:35Scala configuration
- 16:46Series
- 18:18Series Refined
- 21:53Try Script
- 22:48Summary
- 23:53Question
- 25:23Other systems
- 27:18UNIX
- 28:28SBT
- 29:38Loading configurations
related talks
34mEasy and Efficient Data Validation with Cats
06mLayered Configuration and Safe Hot Reload in Rust
34mHow I learned to stop worrying and love Functional Design
44mDesigning code without types
15mStatic Detection of Silent Misconfigurations with Deep Interaction Analysis
50mPrinciples of Elegance
21mLazy Validation and Self-Healing for Agentic Programs
55m“Using Types Effectively"
