ghci reports functions not in scope after loading a .hs, if there is a .o present
I wanted to debug some code, so I fired up ghci and had this experience:
> :l foo.hs ... > my_func 1 2 3 <interactive>:1:0: Not in scope: `my_func'
Apparently, this was because I had previously compiled the code, and ghci noticed the .o file and loaded that instead of the source file. As a result, anything not explicitly exported was not visible.
Once I quit, removed the .o, restarted ghci, and reloaded the file; it worked as I was expecting.
It seems to me that ":load foo.hs" should load foo.hs, with no funny business. Anything else is likely not doing what the user expects. I'd be fine with ":l foo" loading a compiled version if available, and I'm fine with imports from the code I'm loading a compiled version. But, when I explicitly say to load one file, and some other file is loaded instead; that seems like bad behavior.