effects

Why Algebraic Effects?

Why Algebraic Effects Algebraic effects1 (a.k.a. effect handlers) are a very useful up-and-coming feature that I personally think will see a huge surge in popularity in the programming languages of tomorrow. They’re one of the core features of Ante, as well as being the focus of many research languages including Koka, Effekt, Eff, and Flix. However, while many articles or documentation snippets try to explain what effect handlers are (including Ante’s own documentation), few really go in-depth on why you would want to use them.

Continue reading

Algebraic Effects, Ownership, and Borrowing

Introduction Algebraic Effects are a useful abstraction for reasoning about effectful programs by letting us leave the interpretation of these effects to callers. However, most existing literature discusses these in the context of a pure functional language with pervasive sharing of values. What restrictions would we need to introduce algebraic effects into a language with ownership and borrowing - particularly Ante?1 Ownership Consider the following program: effect Read a with read : Unit -> a the_value (value: a) (f: Unit -> b can Read a) : b = handle f () | read () -> resume value This seems like it’d pass type checking at first glance, but we can easily construct a program that tries to use the same moved value twice:

Continue reading