It would be even more "funny" if you'd wrap that `readFile` inside a thunk that gets captured from the environment by the lambda body. Than you'd have a reference to an effect that is supposed to run only inside the lambda but could be executed by external code. Depending on the effect this can have unexpected up to catastrophic outcomes.
That's why Scala introduces so called "capture checking" to make direct style effect systems safe.
https://docs.scala-lang.org/scala3/reference/experimental/cc...
To understand the problem better see:
https://www.inner-product.com/posts/direct-style-effects/#ca...