atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

changes in export from other packages in project are not recognized by ghc-mod #202

Closed andrewufrank closed 7 years ago

andrewufrank commented 7 years ago

i have a multi-package project, build with stack. if i change the interface of a project (for example, adding a function to export) the export is not seen in other packages that import the first one and use of the new function is flagged when compiling (not when building).

when i remove the .stack-work from the relevant package, i get warnings from ghc-mod but after a build project, the new functions are seen and no further warning.

exist a simple multi-package directory somewhere that i could see in what sense my project is different.

thank you!

lierdakil commented 7 years ago

I think this is a ghc-mod bug? Running stack build --only-configure in pretty much any of the packages should fix that (or just stack build), but ghc-mod should do that automatically on environment change. Not sure exactly why it doesn't.

andrewufrank commented 7 years ago

i tried your suggestin stack build --only configure, i also did stack build in atom and outside - no change, open and closed atom - no change. you mentioned a simple multi-package project you build for testing. could you make this available, so i see how you did it and how my project is different?

lierdakil commented 7 years ago

Here you go: https://github.com/lierdakil/test-stack-multiproject

For reference,

$ stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0
andrewufrank commented 7 years ago

i have cloned the project and understand the structure. i did a stack build in a terminal in the super dir (where the stack.yaml is) and get an compilation error (missing function - you commented it out). so far, it seems ok. now i open atom and get ghc-mod not the same version of ghc (8.0.1, should be 8.0.2). when i run stack build ghc-mod i get:

Warning: File listed in a/a.cabal file does not exist: README.md
Warning: File listed in b/b.cabal file does not exist: README.md
ansi-terminal-0.6.2.3: using precompiled package
clock-0.7.2: using precompiled package
cmdargs-0.10.14: using precompiled package
... and many more

i have so far never seen 'using precompile package` - what caused this (it seems to be good). is this the change form lts 8.1 to lts 8.2?

surprisingly (for me) it works and builds when i change the commented out functions. now i will go and investigate what the differences to my project is (except that it is bigger).

thank you - this was very helpful and perhaps you could put the example project into the instructions!

my stack version : Version 1.3.2 x86_64 hpack-0.15.0 -

andrewufrank commented 7 years ago

it seems to work for my project as well. there were two changes: stack.yaml in the superproject folder lts 8.2 removed '.' from stack.yaml all information i got from your example!

lierdakil commented 7 years ago

I believe using precompiled package happens when you've switched resolver, but there is already a version in another resolver that uses the same compiler (and dependencies are consistent).

andrewufrank commented 7 years ago

it seems to work for my project as well. there were two changes: stack.yaml in the superproject folder lts 8.2 removed '.' from stack.yaml all information i got from your example!