On Mar 24, 2022, at 9:04 AM, rowan goemans <goemansrowan@gmail.com> wrote:

is this by design/expected though?

It is by design, yes. With a sufficiently nuanced expectation, I would also say it's expected. (Though, to be fair, if I were not primed to be thinking about the monomorphism restriction, I can't honestly say I would get it right if quizzed.)

Would there be interest in fixing this in GHC?

Figuring out when to generalize a local binding is a hard problem. So, there is definitely interest in finding a better way to do it, but I don't think anyone knows a design that meets the most expectations. Language design is hard! :)

Richard