dry-rb, a set of common monads for Ruby
dry-monads is a set of common monads for Ruby. Monads provide an elegant way of handling errors, exceptions and chaining functions so that the code is much more understandable and has all the error handling, without all the
if
s andelse
s. The gem was inspired by the Kleisli gem.What is a monad, anyway? Simply, a monoid in the category of endofunctors. The term comes from category theory and there are beliefs monads are tough to understand or explain. It’s hard to say why people think so because you certainly don’t need to know category theory for using them, just like you don’t need it for, say, using functions.
Moreover, the best way to develop intuition about monads is looking at examples rather than learning theories.
Source: dry-rb - dry-monads - Introduction
“Simply, a monoid in the category of endofunctors.” What a dry sense of programmer humor.