Context: I want to repl our app from within 'stack ghci'. I've "backported" DevelMain.hs to work with our hand-updated 1.0⟶1.2 scaffolding: see chreekat/ghci-runner and dev/Runner.hs. It ain't workin so hot just yet. There are three main problems, only one of which I'm going to focus on here[1].
Problem: Adding a new Message :reloads as expected, but does not behave as expected.
- I start up my runner mentioned above.
- I add a reference to a new Message (
_{MsgFoo}
) in a template. - I touch the relevant .hs file and :reload. Type error, as expected: No such value "MsgFoo"!
- I add a new entry in messages/en.msg, touch Foundation.hs and :reload again. Compile success.
- I rerun the site (running
main
from dev/Runner.hs in the ghci prompt) and load the page that uses the new Message. Surprisingly, it displays the next Message — that is, the value that is on the next line in messages/en.msg — as if the app was indexing an old version of the array of Messages! - I quit and restart
stack ghci
, and restart the runner, and everything is ok.
Question: What might be to blame for this behavior? Is there potentially any way around it, or has ghci-runner (and foreign-store beneath) gotten too greedy, and dug too deep? Clearly, data from the last run is living on somehow. But where? I'm not really sure where to look.
Thanks!
[1]: For reference, the other two are frequent ghci segfaults (which I can only assume has a similar root cause as this issue with Messages), and the lack of yesod-bin's dependency-tracking for templates et al, which I am experimenting at circumventing with vim magic.
N.B. I am casually using Message as a proto-type (no pun intended) here. If I were to be precise, I would call them value constructors of the datatype generated by mkMessage. But you knew that.