~/talk

Error handling with Monads in Ruby

Talkat RubyConfBY 2020 Online · 2020-07-18..07-19· [ruby, functional-programming]
links:none on file
slides:none on file

A Ruby example app that updates one user demonstrates using dry-monads (the dry-rb Result type) and Result/Try composition to replace exceptions: validate fields, validate email, find (ActiveRecord), update, deliver mail — each returns Success or Failure and composes with bind; Try wraps exception-raising calls. Code uses yield sugar and guard clauses to flatten flow, returns JSON on success, and short-circuits on first Failure. It works but requires a mindset shift and extra onboarding.

AI-written summary · about

  1. 0:00Intro
  2. 1:24History of errors
  3. 3:32Arrow values
  4. 4:51Exceptions
  5. 6:40Context loss corrupt state
  6. 7:59Shifting semantics in notion
  7. 8:37Concurrent and parallel programming
  8. 9:42Simple exceptions
  9. 10:52Monads
  10. 13:15Code examples
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.