Hi all! Thank you for `Effect` feature, really coo...
# arrow
b
Hi all! Thank you for
Effect
feature, really cool how I can type all my effects and play with them purely, one doubt about it: Are we thinking in explore more about Algebraic Effects and bring its concept to this implementation?
👋 1
r
Hi @bloder, do you have an example on how you’d like an algebraic effect modeled? My current impression is the existing combinations of interfaces/impl + context receivers is probably already inline with what one would expect from an algebraic effect system.
b
Hello Raul! Actually my question was with the intention to see if there would be another better approach to it 😅, but I agree with you, I have this same impression. I'm playing a little bit with
Effect
type if I find another better model I open a discussion or something like that.
s
You could say
suspend
+
EffectScope<E>
is more like
MonadError<E>
+
IO
. In such that you can define effects like so
Copy code
interface Console {
  sealed interface Error {
     ...
  }
   
  context(EffectScope<Console.Error>)
  suspend fun putStr(msg: String): Unit

  companion object Default : Console {
     ...
  }
}
My current impression is the existing combinations of interfaces/impl + context receivers is probably already inline with what one would expect from an algebraic effect system.
So yes, 100% this.
👍 1