> I'm baffled that Rust has mostly figured out that whole class of problem before Haskell
Have you heard of `withFile`?
https://www.stackage.org/haddock/lts-20.16/base-4.16.4.0/Sys...
Have you heard of `withFile`?
https://www.stackage.org/haddock/lts-20.16/base-4.16.4.0/Sys...
That being said, even without linear types, it's much harder to accidentally leak a scoped value in Haskell than in most other programming languages, as the leak shows up in the type signature.
/pedantic
Yes, this is true. If someone really wanted they could write a version that didn't using an ST-like type variable trick. I guess it hasn't been considered sufficiently necessary.