|
|
|
|
|
by tel
384 days ago
|
|
They're pretty similar, but with different ergonomics. Algebraic effects are similar to some kind of "free" monad technique, but built in. For being built in they have nicer syntax and better composability, often. You can achieve the same in a language suitably dedicated to monadic approaches (Haskell being the poster child here) but it helps to have type class inference (giving you mtl-like composability) and built-in bind syntax a la Haskell's `do` or Scala's `for`. |
|
A related Scala-specific technique for this problem category is employing the Stackable Trait Pattern[0] to provide a functional style AOP[1] mechanism. Done carefully, effects (aspects) can be defined independent of specific logic as well as composed with provable invocation order.
Note that the references cited are for those reading this thread and not assumed to be required for the person addressed.
0 - https://www.artima.com/articles/scalas-stackable-trait-patte...
1 - https://en.wikipedia.org/wiki/Aspect-oriented_programming