Monads: Exploring Railway Oriented Programming in Ruby
summary
Live coding builds a small Ruby library that implements Railway Oriented Programming: an Outcome monad with Success/Failure types, bind and map for chaining single‑track functions, and an unwrap that raises once for controller error handling. Uses sbet for file typing, a pizza/lunch order example, and tests that end up all passing. Error types (invalid_param, forbidden) are added so failures carry standardized payloads. Code is on GitHub with branches main and use_outcome and the demo completes successfully.
AI-written summary · about
chapters (9)
- 0:00Railway Oriented Programming intro
- 1:45What is Railway Oriented Programming
- 9:10Monad for error handling
- 19:25Encapsulation and chaining with monads
- 23:25Refining error types
- 29:59Single-track functions
- 32:29Unwrapping outcomes
- 34:36Benefits of Railway Oriented Programming
- 36:44Q&A
related talks
29mExploring Railway Oriented Programming in Python
30mRefactoring Ruby with Monads
27mUsing Monads for Elegant Error Handling
25mError handling with Monads in Ruby
26mBlending Functional and OO Programming in Ruby
42mTaking inspiration from the functional world
44mReal-World Functional Ruby
23mSticky Ruby
