# Algebraic effects and handlers, dynamic effects

What exactly are dynamic effects? What does it mean to dynamically create an effect?

In a language with algebraic effects and handlers (such as Eff or Koka) one could already do different operations based on runtime information, for example:  if x > 10 then get () else put 10  In this case the actual operation done will only be known at runtime. But in the Frank paper ("Do be do be do") they talk about dynamic effects in the sense of ML-style references. In what sense are references a dynamic effect that cannot be done in Eff (without resources) or Koka? Also why were resources removed again from Eff?

• You will have to be a bit more specific. What sources did you look at that speak about "dynamic" and "generative" effects? This could mean several things. Generative with respect to the types of return values? Dynamic as in "created at runtime"? – Andrej Bauer Nov 17 '17 at 15:54
• I updated the question a bit, but I guess it's still not specific enough. I am just unclear what is meant in the Frank paper when they talk about Dynamic effects and I couldn't really find any other paper on it, except for the "Eff directly in OCaml" report. – Labbekak Nov 17 '17 at 19:05
• Ok, I think you're talking about resources. It's not clear to me what your question is? You are using the phrase "dynamic effects" which I find to be unclear. I will ask again: where did you get this phrase from? What paper specifically? Then I can have a look to see what you're talking about. If you invented the phrase, then you'll have to explain it. As far as I can tell, you're talking about Eff's instances (not resources). The example you put in your question looks like this question is not research-level. – Andrej Bauer Nov 17 '17 at 20:59
• I got the phrase "dynamic effects" from the "Frank" paper (Future work section) and from the "Eff directly in OCaml" (Higher-order effects). I have to think some more before I can formulate a good question. I agree that it's likely not research-level so I will have to post it somewhere else. Sorry to waste your time. – Labbekak Nov 17 '17 at 21:41
• Ok, thank you, you're talking about instances in Eff terminology. – Andrej Bauer Nov 18 '17 at 10:05

Let us take the example, the input/output effect. Ordinarily, one presents this with two algebraic operations print and read. We can then imagine that things get "printed out" and "read in" from some sort of a communication channel. In fact, that's how I/O works in a typical operating system.
There are other examples where we need to create new instances. One is state, i.e., a memory location with operations update and lookup. Typical programs want to allocate any amount of memory locations, each of which is then an instance of the state effect. In general, instances allow us to create local effects, such as local exceptions and local references. In many applications it is essential to have such effects, for instance so that we can guarantee that only a certain part of the program is allowed to use a certain effect.