~/talk

New types as solution to primitive obsession

Talkat Scala Love 2022 · on Friday, 2022-02-18· [typescript, scala]
links:none on file
slides:none on file

Compares concrete implementations for eliminating primitive-obsession: value classes, opaque types, and tagged types, plus libraries Monix Newtypes, kebs/caps, ZIO Prelude, refined and Mazboot. Shows working examples (Person and Book) with per-field types, validates ISBN checksum and nonblank titles, composes validated fields with for-comprehensions, and explains where validation runs (compile-time assertions in ZIO vs runtime checks in Monix/caps). Notes Scala 2 vs Scala 3 availability, codec/serialization gaps, and that Monix is zero-dependency while ZIO Prelude brings ZIO into the dependency graph.

AI-written summary · about

  1. 0:00Introduction to primitive obsession
  2. 1:05Defining the problem with primitives
  3. 2:57Pure Scala solutions overview
  4. 5:28Target types approach
  5. 6:33Opaque types approach
  6. 7:59Libraries for new types
  7. 8:22Monix new types library
  8. 9:47Demo with Monix new types
  9. 11:57Monix pros and cons
  10. 12:39ZIO Prelude library
  11. 15:15Demo with ZIO Prelude
  12. 16:41ZIO Prelude pros and cons
  13. 17:44Caps Opaque library
  14. 18:47Demo with Caps Opaque
  15. 19:52Caps Opaque pros and cons
  16. 20:13Caps Duct for Scala 2
  17. 21:20Demo with Caps Duct
  18. 22:52Caps Duct pros and cons
  19. 25:02Other libraries overview
  20. 26:33Final conclusions and recommendations
  21. 28:39Q&A and resources
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.