Refactor a Play application using cats and cats‑effect (cats IO)
summary
Refactors a Play Framework API by replacing Scala Future with a generic effect type F[_] using the tagless-final pattern so business logic remains pure and testable. Uses Cats EitherT to validate JSON into case classes and return domain errors as Left or successes as Right (avoiding nested flatMaps), implements concrete effects by bridging Cats Effect IO to Play’s Future to run in Play, publishes events to an event store, and demonstrates the minimal Cats typeclass constraints (Functor/Applicative/MonadError) required for each component.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:45Example app overview
- 3:32Readability issues
- 5:46Cats and Cats-effect intro
- 7:33Replacing Futures with IO
- 9:18Error monad simplification
- 11:07Typeclassing F
- 12:34Choosing IO for prod
- 14:17Play controllers integration
- 16:04Demo and resources
- 17:49Q&A
related talks
21mSo long untyped actors, make way for Akka-Typed
41mHandling billions of events per day with Kotlin Coroutines
37mGenerating Static Websites the Functional Programming Way
27mSmooth Moves: Rendering at the Speed of Right ®
42mFaster Scala Collections with Scalaxy/Streams!
47mReal-world scaling with Scala & Akka
43mFine-grained everything
43mDotty Linker: Precise Types Bring Performance
