Deprecate the realWorld#
There's some messy code about that's intended to prevent problems with the real world. What if we deprecate
realWorld#? People will still be able to shoot themselves in the foot by defining
realWorld# in terms of
runRW#, but a warning in the documentation should hopefully be sufficient to prevent that.
Another, considerably more invasive, option might be to use something like
runST# :: (forall s . State# s -> o) -> o data RealWorld :: * -> * runIO# :: (forall i . State# (RealWorld i) -> o) -> o
This would (I believe) provide a much stronger guarantee that the real world can't escape. But it would probably break considerably more code, so I doubt it would be worth the trouble.