Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Multi component repl #373

Merged
merged 40 commits into from
Nov 1, 2019
Merged

Multi component repl #373

merged 40 commits into from
Nov 1, 2019

Conversation

robrix
Copy link
Contributor

@robrix robrix commented Oct 30, 2019

This PR adds script/repl, which loads everything a ghci session with access to all of the packages’ sources, making it much easier to test stuff out without having to constantly quit & reload &c.

Comment on lines +11 to +12
-- Compile to object code
:set -fwrite-interface -fobject-code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m being a bit opinionated in this file:

  1. I think we want to be able to quit the repl and relaunch it quickly.
  2. I think we don’t want it to load all of the code automatically, since we’re working in various projects.
  3. I think we especially don’t want it to import all of the code automatically.

I think those are fair statements for working on a variety of tasks, but if your particular workflow is made arduous by this, it’s worth revisiting.

Comment on lines +14 to +21
-- Write build products to dist-repl (so that we don’t clobber 'cabal build' outputs)
:set -outputdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
:set -odir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
:set -hidir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
:set -stubdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build

-- Look for autogen’d files in dist-repl
:set -idist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured out that you can convince ghci to build .dyn_o and .dyn_hi files alongside its usual .o and .hi files, and that this is enough to deal with the build errors I was seeing (cf haskell/cabal#6059). However, while this works well enough in fused-effects, it still ends up doing a lot of rebuilding (cf haskell/cabal#3565) in semantic, and the repl builds take longer too due to the added codegen.

Ultimately, I think we’re better off using a separate dist dir for the time being, tho it breaks my very heart.

Comment on lines +53 to +54
-- Bonus: silence “add these modules to your .cabal file” warnings for files we :load
:set -Wno-missing-home-modules
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one hits you for every :loaded file if you don’t turn it off.

@robrix robrix requested a review from a team October 30, 2019 20:46
Copy link
Contributor

@patrickt patrickt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Taking this for a run myself, then will approve.

@patrickt
Copy link
Contributor

Are we supposed to be able to see the packages/modules defined in semantic? Ah, I guess not, since this is a wrapper around cabal exec ghci.

@robrix robrix changed the base branch from play-nice-with-ghcide to master November 1, 2019 12:37
@robrix
Copy link
Contributor Author

robrix commented Nov 1, 2019

Are we supposed to be able to see the packages/modules defined in semantic? Ah, I guess not, since this is a wrapper around cabal exec ghci.

Not sure what you mean? It doesn’t load them by default (because there’s no good way to anticipate what all you’ll need, there may be module name collisions in e.g. the tests, and you probably don’t want everything in scope), so you still need to :load Some.Specific.Module or :load path/to/Some/Specific/File.hs, but everything that depends on should auto-load after that.

@robrix
Copy link
Contributor Author

robrix commented Nov 1, 2019

@patrickt: I addressed your suggestions & also rewrote the relevant section of 💡ProTip!.md, so this is now ready for another glance, modulo #373 (comment).

@robrix robrix requested a review from a team November 1, 2019 14:18
@robrix robrix mentioned this pull request Nov 1, 2019
3 tasks
@robrix robrix merged commit 2a13455 into master Nov 1, 2019
@robrix robrix deleted the multi-component-repl branch November 1, 2019 15:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants