The status of eio and effects composition

To explain my stance, I think it makes sense to describe my intuition about all this related to OCaml as a language.

My initial introduction (a long time ago) to effects in OCaml that made me hyped for them, was Leo Whites talk about typed effects, where I saw how this could bring more FP and more type-safety to the language. Existing effectful functions could suddenly get effect-types, and purity could be enforced in certain places. I also liked what I heard about the partial isomorphism with monad transformers.

My problem now with seeing that compositionality is not a given, and we are unsure about if/when typed effects come at all - is that now I get a feeling that we are moving the language+ecosystem further away from “get what you see” semantics of FP. Related: this is also why I’m critical of modular implicits, as I know how that has been to work with in Scala.

I see the described problem that the effect-based concurrency libraries can have concerning compositionality of handlers, and pragmatism has its advantages sometimes - but as there could be more pure and composeable ways of using effects, that could potentially be useful in OCaml, I feel it looks like a code-smell when:

  • libraries using effects don’t make it explicit how they are not composeable with other effect-handlers and why
  • libraries begin to suggest that other libraries depend on them to exist within them

Ideals I would continue to strive for always, that is already strong within the OCaml community:

  • separation of libraries
  • minimal dependencies
  • typesafety
  • compositionality
  • referential transparency

I like the idea of picos and hope it will gain adoption in all the new concurrency libraries so we can at least have have separation of libraries and minimal dependencies.

4 Likes