Getting started with EitherT
summary
Claims that wrapping Future[Either[E,A]] with EitherT[Future, E, A] (from Cats/Scalaz) makes code readable by avoiding double-unwrapping and enables fast-fail error composition. Shows converting exception-returning DB futures into Either at the boundary, defines an InternalError/ProcessingError hierarchy, and demonstrates leftMap/ensure/fold to remap errors, validate values, and collapse to a single Future result. Examples include name validation, chaining checks across asynchronous calls, and keeping exceptions out of core logic.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:58Understanding Either
- 2:44Right bias in Either
- 4:10Chaining Either operations
- 5:34Either for error handling
- 7:38Combining Future and Either
- 9:25Introducing EitherT
- 11:14Error hierarchy with EitherT
- 12:22Converting exceptions to Either
- 13:25Left-side mapping with EitherT
- 14:07Validating values in EitherT
- 14:50Folding EitherT results
- 15:32Other monad transformers
related talks
18mError Handling Without Throwing Exceptions
25mTYPE-SAFE ERROR HANDLING IN THE AGE OF DOTTY
29mPRACTICAL MONAD TRANSFORMERS
39mFunctional Error Handling with Cats
44mIO monad & Error management: From Exceptions to Cats MTL
46mOptimusPrimeT
32mA practical introduction to category theory
49mAre promises our only choice?
