new-repl: Provide flag to allow access to all transitive dependencies of a component
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
One area that I have found `new-build` regresses is the usability of the REPL. Admittedly this isn't really `new-repl`'s fault as in the old world order I generally never used `cabal repl`; since all of the packages that I care about are in my user package database I could just drop into `ghci` directly and freely import whatever I need.
However, with `new-repl` one is more-or-less forced to use `new-repl` or `ghci` with a GHC environment file. Both of these options have the limitation that you are limited to using packages in the dependency set of a component. I find that this presents a severe usability problem while debugging, where I may start `new-repl`, bring into scope a large number of bindings while drilling down through a problem, and eventually need to import something which isn't a direct dependency of the component I'm in the context of but still in its transitive closure.
At this point I am forced to `:set -package $pkg_name`, which not only clears all of my local bindings, but also clears the in-scope imports. Doing this more than once quickly becomes tiresome.
I think a reasonable way to address this would be to introduce a `new-repl` flag `--add-trans-deps`, which starts `ghci` with all transitive dependencies of the given component available. Of course, this may introduce the occasional need for package-qualified imports, but this is a small price to pay for uninterrupted debugging.
Contributor guide
Research direction
Start at the new-repl flag handling and the setup shared with ghci or cabal repl. Trace how a component's dependency set is assembled, then verify that --add-trans-deps makes its transitive dependencies available without repeatedly resetting the debugging session.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100