Libraries

Practical Algebraic Effects in Ruby with dry-effects

Illustrated by Shiho Pate

Algebraic effects are powerful and versatile abstractions, borrowed primarily from functional programming and set theory. Their general format is made up of two parts, the initial one “introduces an effect” and the following part “handles it”. Remind you of anything? They’re similar to throwing exceptions in most other languages, other than the fact that they don’t stop normal code flow. In this article we’re introduced to a gem called dry-effects, which provides Reader, State, Interrupt, Current Time, Parallel, Resolve, Cache, Env, and Timeout, the first 5 of which are demonstrated with implementations.

To continue reading

Receive

  • Access to original high quality content
  • Priority support and feedback
  • A thank you for supporting our small independant publication

Already purchased issue? Login