Skip to content

Stack ghci should load intermediate dependencies #584

Closed

Description

@hesselink

I often have scenarios where I'm changing two packages (A and C) and I'd like to load them into ghci together. However, there is a third package (B) in between, so that B depends on C, and A depends on B and C. Now, when I do stack ghci A C I will get weird errors:

    Couldn't match type ‘T’
                  with ‘T’
    NB: ‘T’
          is defined in ‘Types.T’
              in package ‘C-0.14.3’
        ‘T’ is defined at
          /my/sources/C/src/Types/T.hs:(36,1)-(49,28)

This is because package B is loaded from the installed library, depending on the installed C, whereas A is using C interpreted. So we have two definitions of type T which are not compatible.

My ideal solution would be if stack ghci A C would also interpret (and not use as a package) all the intermediate dependencies between A and C that are available in the project.

Activity

  1. chrisdone commented on Jul 14, 2015

    @chrisdone
    Member

    Good use-case. This makes sense. If you'd only requested ghci A then it would be acceptable to load B and C from library, but because you want to load C from source, so too should B be loaded. I think this should be more or less straight-forward, we have all the data.

  2. self-assigned this
    on Jul 14, 2015
  3. chrisdone commented on Jul 14, 2015

    @chrisdone
    Member

    Should note for other readers that the workaround is to specify stack ghci A B C manually.

  4. hesselink commented on Jul 14, 2015

    @hesselink
    ContributorAuthor

    Yes, but that quickly becomes annoying if the dependencies grow :) I just stack ghci C only, then stack build A, then stack ghci A. For people with smaller projects, stack ghci without arguments is of course also a good option, but that's too slow for me.

  5. chrisdone commented on Jul 14, 2015

    @chrisdone
    Member

    Of course, it's a workaround, not a solution. ;-)

  6. added this to the milestone on Jul 14, 2015
  7. bergmark commented on Jul 16, 2015

    @bergmark
    Member

    A million +1's, that's +1000000

  8. modified the milestones: , on Sep 12, 2015
  9. mgsloan commented on Nov 28, 2015

    @mgsloan
    Contributor

    Done!

    I've opened a separate issue for handling the case where these intermediate dependencies are non-local packages: #1441

  10. hesselink commented on Nov 28, 2015

    @hesselink
    ContributorAuthor

    Great! I just installed and it seems to work very well on my first tests. This is going to make my development workflow much smoother.

    One thing I noticed is that it will still try to build the packages it's loading if they've changed. You can pass --no-build to skip that, but maybe that should be the default? I can't see any reason anymore to build those packages.

  11. mgsloan commented on Nov 30, 2015

    @mgsloan
    Contributor

    The reason those are built is to ensure that autogenerated files are updated. Removing this default is covered in #1364

  12. hesselink commented on Nov 30, 2015

    @hesselink
    ContributorAuthor

    Great, thanks!

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions