Skip to content

Add --with-repl flag to modify program the "repl" starts with #10996

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mpickering
Copy link
Collaborator

Programs like doctest and hie-bios want to use cabal-install in order
to discover the correct options to start a GHC session. Previously they
used the --with-compiler option, but this led to complications since
the wrapper was called for compiling all dependencies and so on, the
shim had to be more complicated and forward arguments onto the user's
version of GHC.

The --with-repl command allows you to pass a program which is used
instead of GHC at the final invocation of the repl. Therefore the
wrappers don't have to deal with being a complete shim but can
concentrate on intercepting the arguments at the end.

This commit removes the special hack to not use response files with
--interactive mode. Tools are expected to deal with them appropiately,
which is much easier now only one invocation is passed to the wrapper.

Fixes #9115


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

This refactoring modifies the logic to start the multi-repl to use
runGHCWithResponseFile rather than directly constructing a command line.

Towards #10881
@mpickering mpickering changed the title Wip/for repl Add --with-repl flag to modify program the "repl" starts with Jun 17, 2025
@mpickering
Copy link
Collaborator Author

@sol @fendor Can you please test this patch works for your use case?

TODO

  • Documentation
  • Changelog

@fendor
Copy link
Collaborator

fendor commented Jun 17, 2025

haskell/hie-bios#466

> hie-bios debug src/HIE/Bios.hs                                                                                                       
Root directory:        /home/hugin/Documents/haskell/hie-bios
Component directory:   /home/hugin/Documents/haskell/hie-bios
GHC options:           @/tmp/ghci84462-0.rsp
GHC library directory: CradleSuccess "/home/hugin/.ghcup/ghc/9.6.7/lib/ghc-9.6.7/lib"
GHC version:           CradleSuccess "9.6.7"
Config Location:       No explicit config found
Cradle:                Cradle{ cradleRootDir = "/home/hugin/Documents/haskell/hie-bios", cradleOptsProg = CradleAction: Cabal}
Dependencies:          hie-bios.cabal cabal.project cabal.project.local

The branch passes the test-suite with the cabal binary from this branch.

@mpickering mpickering force-pushed the wip/for-repl branch 3 times, most recently from a9c95e6 to 30435ac Compare June 18, 2025 15:57
Programs like doctest and hie-bios want to use `cabal-install` in order
to discover the correct options to start a GHC session.  Previously they
used the `--with-compiler` option, but this led to complications since
the wrapper was called for compiling all dependencies and so on, the
shim had to be more complicated and forward arguments onto the user's
version of GHC.

The `--with-repl` command allows you to pass a program which is used
instead of GHC at the final invocation of the repl. Therefore the
wrappers don't have to deal with being a complete shim but can
concentrate on intercepting the arguments at the end.

This commit removes the special hack to not use response files with
--interactive mode. Tools are expected to deal with them appropiately,
which is much easier now only one invocation is passed to the wrapper.

Fixes #9115
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add --with-repl option
2 participants