Programming Safely in an Uncertain World
summary
Claims that algebraic data types let code collapse multiple failure modes into a single result and avoid exceptions, demonstrated with Maybe type and composition via map/chain (flatMap). Uses Sanctuary and sanctuary-def inside the node Ripple REPL to parse JSON, validate X/Y/Z as an array of strings, map safe hex parsing, use sequence to turn maybes into a single maybe and sum the results. Constructs a pipeline that handles about seven failure cases and returns Just [1,2,3] (then the sum).
AI-written summary · about
chapters (8)
- 0:00Intro
- 10:25FlatMap
- 14:38PauseJason
- 18:07False Sequence
- 25:40Node Ripple
- 26:07Syntax Error
- 26:35Sanctuary vs RamDes
- 27:27Promises
related talks
55mWhy JavaScript Programmers Should Learn Algebraic Data Types
56mFunctional Programming with JavaScript
27mUsing Monads for Elegant Error Handling
25mLeveraging (algebraic data) types to make your UI rock solid
41mFunctional programming: Give it a chance!
34mMo' Problems, Mo 'Nads
31mMONADS - CODING FUNCTIONALLY
29mUnexpected Monad. Is Safe Error Handling Possible in JS/TS?
