runST does not prevent resources from escaping

Yes, congratulations, you have just invented Bluefin! (well, modulo :&, which is needed for having resources with different lifetimes).

@Leary’s caveats are essential, and @Leary first pointed out to me here the necessity of keeping the type index on the monad too:

2 Likes