Do I build my language's IO model on top of monads, or on top of algebraic effects?
Conversation
Monads feel more structurally tangible, algebraic effects feel more expressive/composable...
1
What do you mean by ‘structurally tangible’?
1
They feel less arbitrary. Algebraic effects feel made up, then justified ad-hoc within a type system, whereas monads feel like they're a more fundamental emergent property of a type system. Just a vibe I have though.
1
Yeah I understand that vibe. Perhaps it is because lots of the user-facing stuff is happening in the surface language? I dunno.
1
1
There is more precision and theoretical motivation there if you go into the theory of algebraic effects, but it is a bit of a mountain to climb. “What is algebraic about algebraic effects and handlers?” goes into more details, but it's a bit heavy:
1
There are some videos online to go with those notes:
Oh another to thing to think about (now that I remember), is the idea that top-level IO should not be considered monadic: math.andrej.com/2019/10/28/run - I think this has implications whether or not you use monads or algebraic effects?
One thing to think about is also that there are multiple ways of constructing monads. Haskell makes an ad-hoc decision what to prioritise, but there are other options: ocaml-preface.github.io/preface/Prefac

