- Dave Moore
- Maria Ivanova Gorinova
Algebraic effects and handlers have recently emerged in the PL community as a convenient, modular abstraction for controlling computational effects. They have found applications including concurrent programming, meta programming, and recently have been applied to probabilistic programming, for example, in Pyro's Poutines library.
We investigate the use of effect handlers as an lightweight abstraction for implementing PPLs. Our work is motivated by a desire to compose transformations of models in the Edward2 probabilistic programming framework (Tran et al., 2018). We begin by discussing algebraic effects, and their application to implementing probabilistic programming systems. We proceed to understand the existing design of Edward2 as an accidental implementation of an effect-handling mechanism, and extend that design to support nested, composable transformations. We demonstrate that this enables straightforward implementation of sophisticated model transformations and inference algorithms.