Closed davidsd closed 3 years ago
The problem appears to go away if I use ghcid --command "stack ghci --ghci-options=-fobject-code"
(so that is what I will do for now). So I guess it's another strange thing about Template Haskell and -fno-code
. Still, I'd like to understand what's going on.
Sorry for spamming this page, but it appears that -fobject-code
is not a great solution, as I'm seeing strange behavior like errors not appearing immediately on saving, errors appearing and disappearing when I add comments, etc.
These all seem like underlying issues with the ghci
that ghcid is being invoked with - TemplateHaskell has always been a bit odd, and buggy. If you can figure out the ideal command line, and it doesn't have a performance implication (which -fobject-code
probably would), we can switch to it by default. Unfortunately, unless someone fixes ghci
itself, the bugs are likely to remain :(
That's good to know -- do you think I should file a GHC bug report about this? The problem is that I don't know precisely how to get the weird behavior with just ghci.
A ghci only bug report would be great - but my experience is they rarely get fixed. I raised a bunch 6 years ago and they remain, unloved, and figuring out good but reports is a pain. It's a valuable thing to do though. I leave it to your choice.
Sounds good. In any case, I will close this issue since it seems there isn't anything more to do here.
I have some Template Haskell that finds all
Show
instances in scope (usingreify ''Show
) and creates corresponding instances of a custom typeclassStatic (Show ...)
. It runs fine withstack build
andstack ghci
. However, when I useghcid
, I get a bunch of errors:Strangely, I don't use
Data.SOP
in my project at all! And indeed no such instances appear when I do-ddump-splices
withstack build
. It seems thatreify ''Show
is finding differentShow
instances when I useghcid
than when I usestack ghci
orstack build
.Do you have any suggestions for what is going on and how I could mitigate the problem? I thought maybe I should change my code to only use instances from specific modules, but I can't figure out how to do that in Template Haskell.