Skip to content

cabal new-repl target1 target2 shouldn't bring up GHCi prompt twice #3659

Closed

Description

@ezyang

When I run cabal new-repl with two targets, what it does is first bring up GHCi for the first target, and then the second target, UNLESS they are both targets from the same package, in which case only one target is brought up.

There are some relevant TODOs in the code in elaboratePackageTargets:

        --TODO: instead of listToMaybe we should be reporting an error here
        replTargets   = listToMaybe
                      . nubComponentTargets
                      . map compatSubComponentTargets
                      . concatMap elaborateReplTarget
                      $ targets

Activity

  1. added
    cabal-install: v2-build system
    on Aug 2, 2016
  2. ezyang commented on Aug 24, 2016

    @ezyang
    ContributorAuthor
  3. dcoutts commented on Sep 4, 2016

    @dcoutts
    Contributor

    Should simply fail if two targets are given if they span different components.

    FYI, I'd prefer not to go down the route of trying to pretend that ghci supports multiple packages by unioning everything together and preying (as stack does). Of course, if we can get ghci to support multiple "home" packages then that'd be nice. That said, I've no problem with revisiting the design where it loads all modules to start with, rather than letting you (but making you) load the ones you want.

  4. dcoutts commented on Sep 4, 2016

    @dcoutts
    Contributor

    @hesselink any chance you could explain in more detail the problems you have had with cabal repl?

  5. hesselink commented on Sep 5, 2016

    @hesselink
    Contributor

    It's been a while... One that I remember was very annoying was that cabal repl would fail to launch if there were type errors (!). I think this was #1715 and it's marked as fixed. I just tried a few packages and most things seem to work. One thing I did notice is that repl doesn't do an install, which means you can't just call repl, you have to remember to do install --only-dep first. It would be nice if common use cases just did what was needed.

    Regarding the discussion above: I often load two components of the same package, e.g. a library and the test suite. Additionally, I often have a development flow where I load two packages together, including their intermediate dependencies that are also part of the project. This is a very convenient flow while developing: first make a library change (in the repl), then fix all the integration issues up to the final executable (again in the repl). I can see that there are difficult details involved, but I've used it for quite a while (in stack) with a large number of packages, and never had issues :-)

  6. modified the milestones: ⊥, Triaged on Sep 8, 2016
  7. Ericson2314 commented on Apr 4, 2018

    @Ericson2314
    Collaborator

    There is a class of package which are simple enough such that multi-package repl is trivial (just pass more deps and -i flags to ghci). [This ignores detecting improperly used dependencies and unexported modules but I think that's OK for now.] Can we teach Cabal to recognize those case and support them?

    Stack has had some form of multi-package repl for a while now, so it would be good to get started on that.

  8. jkachmar commented on Apr 2, 2020

    @jkachmar

    Is there anything that an individual contributor might be able to do to support this issue?

    I've grown accustomed to stack's ability to load multiple targets at once and I'd very much like to see cabal v2-repl gain similar functionality if possible.

    It's helpful most notably when working on a project with one or more test suites, so that companion tools like ghcid can reload across the whole project and run tests once compilation is green.

    cc @phadej because this is a very old issue and it seems like you're the most active contributor at the moment, but if I should direct this towards someone else please let me know.

  9. Ericson2314 commented on Apr 2, 2020

    @Ericson2314
    Collaborator

    Yes there is! Help me https://gitlab.haskell.org/ghc/ghc/merge_requests/935, which I sadly haven't attended to lately.

    Everything stack does, and anything Cabal could do is a workaround. To really fix the problem is to fix GHC, and that PR goes after the bulk of the work (changing CLI etc is the victory lap).

  10. jkachmar commented on Apr 3, 2020

    @jkachmar

    Thanks!

    I’m reading up on this GHC PR, the proposal, and some of the related issues, are you on the Haskell IRC or is there a better place to follow-up with you if I have the time or capacity to help with this?

  11. Ericson2314 commented on Apr 3, 2020

    @Ericson2314
    Collaborator

    Sorry I was cooking and eating dinner then. Back now. Find me in #ghc.

  12. fendor commented on Apr 3, 2020

    @fendor
    Collaborator
  13. L-as commented on Jun 19, 2021

    @L-as

    What is the current status of this feature?

  14. fendor commented on Jun 21, 2021

    @fendor
    Collaborator

    The linked work is being split into smaller units of work and semi-actively being worked on. There is currently no ETA, or any concrete plan to integrate the feature into cabal itself.

  15. ulysses4ever commented on Sep 15, 2022

    @ulysses4ever
    Collaborator

    Duncan seems to have gotten around to implement a graceful error message in def073a. I think this can be closed, and other tickets with actual feature requests in this spaces should be used going forward (e.g. #8238)

  16. Mikolaj commented on Sep 19, 2022

    @Mikolaj
    Member

    Well spotted. Closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: v2-build systemtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions