do drop me a line if I can be of any help with anything
I appreciate this!
Overall, you, and some other people in this conversation, pay a lot of attention to particular things like whether a state monad is strict and whether an effect system is efficient, while entirely ignoring other things like whether a state monad arises from an adjunction as I mentioned and whether an effect system encodes a free model of an algebraic theory. This is a backwards way of thinking. As if we were trying to decide how many angels can dance on the tip of a pin without ever having agreed what an angel is. This is exactly what I uncharitably called out in my first message:
a case of computer programmers ruining something beautiful out of ignorance
I am sad to see this suspicion confirmed. If the brightest minds of Haskell (I count you here, Tom) cannot tell me in simple words what they have been talking about all this time, then we are in big trouble.
Earlier today I also looked at the documentation of effectful
that you have linked, and now I am not sure whether Andrzej is genuinely missing the point of the monad transformers in question or intentionally spinning the discourse in his own favour. Monad transformers implement certain specific categorial constructions — and, as far as I know, they behave exactly as one would expect having understood their categorial specification. No one has the authority to say that they are «incorrect», «confusing» or «even worse» based on their own unchecked expectations.
The state monad transformer arises from the
curry
–uncurry
adjunctionI’ve never found this a useful way of thinking. What non-trivial conclusion have you obtained from that knowledge?
That StateT monad
is a monad insofar as monad
is, to begin with. This is more than I can say about this Eff
thing you displayed. If it does not implement free models of algebraic theories, then how can I know if it is a monad? It looks to me like it could be a chunk of a device driver out of the Linux kernel.
No, effect systems that are
IO
wrappers (Bluefin, effectful,ReaderT IO
, etc.) can only deal with effects that have at most a single continuation. Most effects have a single continuation, exceptions have zero. ThereforeIO
wrapper effect systems cannot handle the style of “non-determinism” as seen inLogicT
.
Now we are getting somewhere. So, effects are things that have zero or one continuation each. Can you explain in simple yet precise language what it means for an effect to have zero, one or two continuations? Without displaying any more device drivers?
Transformers are “synthetic”. They build “effects” from language primitives and allow you to compose them. For example,
StateT s (ExceptT e (Reader r)) a
is an algebraic data type, just formed from the language primitives sums, products and exponentials.By contrast, Bluefin and effectful are “analytic”. They are simply
IO
underneath.
I think better words may be «external» and «internal». The «external» or in your language «synthetic» are those that rely on the denotation of Haskell, and the «internal» or in your language «analytic» are those that rely on the operation of GHC. Is this agreeable?
What about the «freer monads, more extensible effects» thing? What kind of effect system is it in this classification?
This classification does clarify something.
My understanding is now that people gave up on trying to make synthetic effect systems asymptotically efficient, and instead started to move them into GHC. So, first we had external (synthetic) effect systems, and then we started to build internal (analytic) ones.
I do not understand any of the details here, however. Is it true that external (synthetic) effect systems are necessarily asymptotically less efficient than an «ideal» effect system?
I faintly recall Alexander @graninas writing somewhere that the problems of efficiency are solved by using continuation passing style, and this sounded plausible to me at the time, but I cannot right now recall any details… Is this what Armando @Ambrose had in mind when he said «new ideas with continuations» above?