New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHCI script shouldn't load packages separately #3309

Closed
mgsloan opened this Issue Aug 3, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@mgsloan
Collaborator

mgsloan commented Aug 3, 2017

#2457 added a change to load packages individually. This has caused some non-ideal behavior when loading multiple packages into ghci / intero. Also, I've observed that the approach doesn't work in general, its success is non-deterministic. In particular:

  1. This causes it to output "Ok, modules loaded: " messages N types, where N = number of packages.

  2. If an error occurs, it can be repeated upto N times, filling up your console with duplicated errors.

  3. It doesn't order the packages based on dependency order, so if package A is before package B in the list, and A depends on B, by the time it asks to load B's modules, they've already been loaded. So sometimes the source path setting doesn't work. So, the primary motivation for that change doesn't always work.

  4. Intero re-collects type info for every load statement. This is probably an issue with intero. But since it is

  5. The setting of cwd does not replay on reload.

So generally, that change was a major downgrade in how stack ghci behaves, and it does not really properly support switching cwd.

I'm working on a change to go back to pretty much how scripts were generated before, this is documenting the motivation for the change. It will still benefit from :cd-ghc in the case that intero is just loading one package, which I believe is the default in emacs

@lwm

This comment has been minimized.

Member

lwm commented Aug 21, 2017

@mgsloan, while dogfooding with the latest stack, I discovered that the default stack ghci doesn't load up any modules any more. I tried stack ghci --load and nothing was loaded either. I found my way here - do I understand correctly that this change shouldn't affect this default behavior? Maybe I'm on the wrong track too though.

Here's my log:

λ ~/hobby/stack/ master stack --version                                         
Version 1.5.1, Git revision e6fde2ef177dd31d4d68bb204d4e0dc3c3920f81 (5118 commits) x86_64 hpack-0.18.1
λ ~/hobby/stack/ master stack ghci     
Configuring GHCi with the following packages: 
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/lwm/dotfiles/dotfiles/ghc/ghci
Loaded GHCi configuration from /tmp/ghci20785/ghci-script
λ :show modules
λ :load src/Stack/Upload.hs
[1 of 1] Compiling Stack.Upload     ( src/Stack/Upload.hs, interpreted )
Ok, modules loaded: Stack.Upload.
λ :show modules
Stack.Upload     ( src/Stack/Upload.hs, interpreted )

mgsloan added a commit that referenced this issue Aug 22, 2017

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Aug 22, 2017

@lwm Ah, good catch, silly mistake on my part. Fix pushed to master.

@lwm

This comment has been minimized.

Member

lwm commented Aug 23, 2017

Nice one! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment