BartoszMilewski / Publications

Misc. publications, conference slides, etc. For more, go to http://BartoszMilewski.com
1.24k stars 38 forks source link

Algebraic Effects a.k.a. Unordered Stacking of Free Monads #13

Open iacore opened 2 years ago

iacore commented 2 years ago

Hello, I didn't see algebraic effects mentioned in the Dao of FP, so here's some information about it.

If you have M0 () and M1 (), you can stack them and get Union [M0, M1] ()

A programming language using this trick to make reasoning about effects easier: https://koka-lang.github.io/ References: https://koka-lang.github.io/koka/doc/book.html#sec-implementation Implementation in Idris2: https://github.com/locriacyber/idris2-eff

Note that in the original papers the stacking is limited by "Row", i.e. you cannot stack M A0 () with M A1 () (higher-ordered free monads). The implementation in Idris2 doesn't have this limitation. Maybe it is a limitation from the Hindley-Miller type system.