Are promises our only choice?
summary
Promises have eager evaluation, errors type as any, and let you omit catches, so this demo switches to fpts Task and TaskEither to get lazy evaluation and explicit error types, shows composing tasks with pipe to preserve referential transparency, sequences tasks so a failing step short‑circuits remaining work, uses remote-data to represent initial / pending / failure / success states for UI, and demonstrates Futures that run lazily and return a cancel function so long‑running requests can be unsubscribed.
AI-written summary · about
chapters (12)
- 0:00Async operations intro
- 5:17Promise limitations
- 6:00What is functional programming
- 8:32Functional alternatives
- 9:39Lazy evaluation with tasks
- 13:42Composable functions
- 18:06Referential transparency
- 20:34Short-circuiting with tasks
- 24:28Error handling with Either
- 35:14Async states with RemoteData
- 39:59Cancellable futures
- 47:15Conclusion and key takeaways
related talks
40mPromises are much better than you think
28mIn Many Cases, Promises May Make For A Better Pattern Than async/await
04mA Promise is a Promise
01h 00mJavascript Promises vs async-await
27mPractical functional programming: pick two
45mPromises — It Doesn't Have to Hurt
32mPromises Are So Passé
16mGetting started with EitherT
