Open abailly opened 7 years ago
What's your actual use case for effects that call one another? I'm wondering if there might be some other, simpler way of decomposing the problem.
Thanks for your answer @isovector ! The actual use case is a bit hard to explain in details but the idea is that we have some effect in the middle of a stack that interacts with an external system (a distributed log) to process transactions. And the return value can contain more transactions to process from a previous point in the stack, hence the mutual dependency between two effects.
I can imagine something like returning a value denoting a "continuation", or even returning an Eff
but I was really wondering if there would not be a possibility to "tie the knot" in a sequence of effects, something like a mfix
maybe?
I ran into the need for something like mfix
today too. Any further thoughts on this problem?
I would like to implement 2 effects, say
A
andB
, which would be calling each other. This lead me to the following code which I don't find very satisfactory:In particular, I don't like having to define
runA'
andrunB'
nor having to useforever
. It seems to me I should be able to tie the knot of a recursive implementation withrunA
andrunB
but it keeps eluding me.