DEV Community

Discussion on: Mastering Monadical Syntax in Ruby: A Practical Guide to Functional Elegance

Collapse
 
pimp_my_ruby profile image
Pimp My Ruby • Edited

Actually, the Try monads is just a mapping rescue

Try[Error] { '123' }
<==>
begin
  Success('123')
catch Error => e
  Failure(e)
end
Enter fullscreen mode Exit fullscreen mode

So it is "just" sugar syntax

Collapse
 
cherryramatis profile image
Cherry Ramatis

Oh this is awesome actually, so it's possible to use this as a way to always have the provided monads