Lambda the Ultimate - Effects
http://lambda-the-ultimate.org/taxonomy/term/35/0
Effects and Effect SystemsenLatent Effects for Reusable Language Components
http://lambda-the-ultimate.org/node/5640
<p >Latent Effects for Reusable Language Components, by Birthe van den Berg, Tom Schrijvers, Casper Bach Poulsen, Nicolas Wu:</p>
<blockquote ><p >The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based “datatypes "a la carte" (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the<br >
current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.</p></blockquote>
<p >Looks like a nice generalization of the basic approach taken by algebraic effects to more subtle contexts. Algebraic effects <a href="https://duckduckgo.com/?q=site%3Alambda-the-ultimate.org%2F+algebraic+effects&atb=v213-1&ia=web">have been discussed here on LtU many times</a>. I think this description from section 2.3 is a pretty good overview of their approach:</p>
<blockquote ><p >LE&H is based on a different, more sophisticated structure than AE&H’s free monad. This structure supports non-atomic operations (e.g., function abstraction, thunking, quoting) that contain or delimit computations whose execution may be deferred. Also, the layered handling is different. The idea is still the same, to replace bit by bit the structure of the tree by its meaning. Yet, while AE&H grows the meaning around the shrinking tree, LE&H grows little “pockets of meaning” around the individual nodes remaining in the tree, and not just around the root. The latter supports deferred effects because later handlers can still re-arrange the semantic pockets created by earlier handlers.</p></blockquote>EffectsFunctionalTheoryThu, 14 Oct 2021 14:02:48 +0000Implementing Algebraic Effects in C
http://lambda-the-ultimate.org/node/5457
<p ><a href="https://www.microsoft.com/en-us/research/publication/implementing-algebraic-effects-c/">Implementing Algebraic Effects in C</a> by Daan Leijen:</p>
<blockquote ><p >We describe a full implementation of algebraic effects and handlers as a library in standard and portable C99, where effect operations can be used just like regular C functions. We use a formal operational semantics to guide the C implementation at every step where an evaluation context corresponds directly to a particular C execution context. Finally we show a novel extension to the formal semantics to describe optimized tail resumptions and prove that the extension is sound. This gives two orders of magnitude improvement to the performance of tail resumptive operations (up to about 150 million operations per second on a Core i7@2.6GHz)</p></blockquote>
<p >Another great paper by Daan Leijen, this time on a C library with immediate practical applications at Microsoft. The applicability is much wider though, since it's an ordinary C library for defining and using arbitrary algebraic effects. It looks pretty usable and is faster and more general than most of the C coroutine libraries that already exist.</p>
<p >It's a nice addition to your toolbox for creating language runtimes in C, particularly since it provides a unified, structured way of creating and handling a variety of sophisticated language behaviours, like async/await, in ordinary C with good performance. There has been considerable discussion here of C and low-level languages with green threads, coroutines and so on, so hopefully others will find this useful!</p>EffectsImplementationLambda CalculusSemanticsThu, 27 Jul 2017 13:50:17 +0000No value restriction is needed for algebraic effects and handlers
http://lambda-the-ultimate.org/node/5343
<p ><a href="https://arxiv.org/pdf/1605.06938v1.pdf">No value restriction is needed for algebraic effects and handlers</a>, by Ohad Kammar and Matija Pretnar:</p>
<blockquote ><p >We present a straightforward, sound Hindley-Milner polymorphic type system for algebraic effects and handlers in a call-by-value calculus, which allows type variable generalisation of arbitrary computations, not just values. This result is surprising. On the one hand, the soundness of unrestricted call-by-value Hindley-Milner polymorphism is known to fail in the presence of computational effects such as reference cells and continuations. On the other hand, many programming examples can be recast to use effect handlers instead of these effects. Analysing the expressive power of effect handlers with respect to state effects, we claim handlers cannot express reference cells, and show they can simulate dynamically scoped state.</p></blockquote>
<p >Looks like a nice integration of algebraic effects with simple Hindly-Milner, but which yields some unintuitive conclusions. At least I certainly found the possibility of supporting dynamically scoped state but not reference cells surprising!</p>
<p >It highlights the need for some future work to support true reference cells, namely a polymorphic type and effect system to generate fresh instances.</p>EffectsFunctionalType TheoryWed, 25 May 2016 13:54:59 +0000Programming with Algebraic Effects and Handlers
http://lambda-the-ultimate.org/node/4481
<p ><a href="http://math.andrej.com/2012/03/08/programming-with-algebraic-effects-and-handlers/">Programming with Algebraic Effects and Handlers</a>. Andrej Bauer and Matija Pretnar, arXiv preprint.</p>
<blockquote ><p >Eff is a programming language based on the algebraic approach to computational effects, in which effects are viewed as algebraic operations and effect handlers as homomorphisms from free algebras. Eff supports first-class effects and handlers through which we may easily define new computational effects, seamlessly combine existing ones, and handle them in novel ways. We give a denotational semantics of eff and discuss a prototype implementation based on it. Through examples we demonstrate how the standard effects are treated in eff, and how eff supports programming techniques that use various forms of delimited continuations, such as backtracking, breadth-first search, selection functionals, cooperative multi-threading, and others.</p></blockquote>
<p >Eff has been <a href="http://lambda-the-ultimate.org/node/4090">discussed here before</a>, and it's nice to see some more progress and a much more complete introduction. The paper is intended for a general audience (well, a general audience of PL enthusiasts). It's quite clear and contains a wealth of examples.</p>EffectsFunctionalTue, 13 Mar 2012 05:46:22 +0000Eff - Language of the Future
http://lambda-the-ultimate.org/node/4090
<p >This is just a series of blog posts so far, as far as I can tell. But Andrej Bauer's work has been mentioned here many times, I am finding these posts extremely interesting, and I'm sure I will not be alone. So without further ado...</p>
<p ><a href="http://math.andrej.com/2010/09/27/programming-with-effects-i-theory/">Programming With Effects</a>. Andrej Bauer and Matija Pretnar.</p>
<blockquote ><p >
I just returned from Paris where I was visiting the INRIA Ï€rÂ² team. It was a great visit, everyone was very hospitable, the food was great, and the weather was nice. I spoke at their seminar where I presented a new programming language eff which is based on the idea that computational effects are algebras. The language has been designed and implemented jointly by Matija Pretnar and myself. Eff is far from being finished, but I think it is ready to be shown to the world. What follows is an extended transcript of the talk I gave in Paris. It is divided into two posts. The present one reviews the basic theory of algebras for a signature and how they are related to computational effects. The impatient readers can skip ahead to <a href="http://math.andrej.com/2010/09/27/programming-with-effects-ii-introducing-eff/">the second part</a>, which is about the programming language.
</p></blockquote>EffectsFunFunctionalTheoryWed, 29 Sep 2010 02:30:18 +0000