Closed robrix closed 7 years ago
Sounds great! These changes would be very welcome. Thanks a lot for taking the time to work on this.
We hang out in #haskell-ide-engine on freenode, so you can drop in there any time.
I'm not sure about the git submodule change though, @alanz is better qualified to talk about that.
I’ve spent some time this morning working on upgrading everything (cabal-helper, ghc-mod, ghc-mod-core, HaRe… everything) to work with ghc 8.2.1. I’m not done just yet, but I had a couple of thoughts that might make this sort of task easier in future, and I wanted to see whether you think they’d be worth doing or not.
Use git submodules instead of git ref packages in stack.yaml.
It’s inconvenient having to bump the SHA in stack.yaml, rebuild, wait for stack to fetch, etc., for every tweak to e.g. ghc-mod. Also, stack sometimes gets confused and you have to blow away ~/.stack-work/downloaded/ to sort things out.
The workflow is a lot simpler when you have everything checked out directly, and I feel like that outweighs the inconvenience of having to occasionally
git submodule update --init --recursive
.Use record selectors to pattern match against GHC types.
This mostly affects
HaRePlugin.hs
. A lot of ghc’s declaration constructors got fixities added to them in 8.2.1, which required adding a bunch of_
s and will potentially also requireCPP
and#if __GLASGOW_HASKELL__ >= 802
guards to retain support for older ghc versions. SincegetSymbols
really only needs thetcdLName
field, we could use the record selectors to get them out, e.g. by replacing this:with this:
Realistically, this may or may not future-proof the project much since there’s countless ways ghc could change that would still invalidate this pattern match. (I haven’t looked at any past versions to see how unstable these datatypes & the record selectors are, either, tho that doesn’t necessarily predict future change.) But it would at least allow us to avoid
CPP
& a bunch of version-specific guards.Some of the dependencies, e.g. ghc-mod & HaRe, have a lot more to gain from this suggestion, so I might take this upstream as well.
Let me know what you think; if these changes would be welcome, I’ll be happy to see them through.