Can linear types make this implementation of `inits` safe?

My mistake: from your response here, I thought you were looking for a solution that wasn’t (as) lazy. The original (lazier) version of ST s a is still available - it’s just that most prefer the strict version to avoid space leaks…


The moral reason is that I want to write algorithms declaratively.

But (in this definition) using unsafe... entities - this could be of some use: