Maybe buggy recompilation behavior


#1

I’m having a puzzling problem. I don’t have it down to a short reproducible case, as the program is long and I have no idea what the issue is.

My program has a couple dozen files. When I make a trivial change to one of them, file A, even to code that is not going to be called, the program stops working properly with mysterious behavior that’s almost like a compiler bug, it makes so little sense. Only when I make a change to another file B that imports file A, does the program work again. This can be the most trivial of changes, like changing a constant in a function in B that’s not even called anywhere-- or even just adding whitespace – it breaks. Then change file A (even adding whitespace) and it works again.


#2

Yes, I think many of us see issues like this occasionally. Without a short reproducible case though, there’s not really going to be much we can do, unfortunately. You may want to clear your output/ directory (if you haven’t already done so) in order to force the whole project to be rebuilt from scratch.


#3

It gets stranger, but I don’t think it’s purs’s fault at this point. I shut down my MacBook and later booted it up again. I went to study the files in question, and one of them was an old version. Nowhere in sight were the changes I had made over several hours earlier today, and after which the problem had started.

My best guess is that I had a file open in two editor instances by mistake, with different versions in each editor – and the final version I saved was the “old” one, overwriting a few hours of changes. Still a mysterious explanation, because wouldn’t I have noticed two editor instances? (I use Emacs.)

It seems to work robustly now.

Mike


#4

Good to hear! Thanks for the update.


#5

I discovered more about the problem. It’s related to the purs-ide mode in Emacs. You know how, when you start purs-ide, it asks for the root directory? For some reason, after you type that, it becomes the default directory for saving files (using write-file), even in buffers that are visiting files in other directories. So when I was working on a module and did write-file to a new name, I thought it would go in the same directory as the original module, but it went into the project root instead (above ‘src’). That’s why I wasn’t aware that my modifications to that module were not being picked up by purs.