I’ve got some code that I brute forced like this:
do let i1 = 0 i2 <- fn i1 i3 <- fn i2 i4 <- fn i3 i5 <- fn i4 pure [i1, i2, i3, i4, i5]
let i1 = 0 in fn i1 >>= \i2 -> fn i2 >>= \i3 -> fn i3 >>= \i4 -> fn i4 >>= \i5 -> pure [i1, i2, i3, i4, i5]
but with even more iterations than that. Clearly, it calls for some sort of loop, but I’m having a tough time though figuring out how to do that when I’m inside a monad already. I think it would just be a fold over
>>= fn if I could throw away the value at each iteration, but then I can’t see how to assemble the answer at the end. Any pointers?
Thanks in advance!