Skip to content
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

Allow GHCi to load non-local packages by unpacking them #1441

Open
mgsloan opened this issue Nov 28, 2015 · 3 comments
Open

Allow GHCi to load non-local packages by unpacking them #1441

mgsloan opened this issue Nov 28, 2015 · 3 comments

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Nov 28, 2015

It'd be cool if stack ghci text unpacked text and loaded it into ghci. This is also relevant to the code recently added for also loading intermediate deps (#584) - it will need to be modified to handle the PSUpstream case.

@StevenXL
Copy link

Is this still an issue? I can run stack ghci --package text. Are we talking about something else?

@nekoniaow
Copy link

nekoniaow commented Nov 3, 2022

Is this still an issue? I can run stack ghci --package text. Are we talking about something else?

This seems to be about packages which are referenced from the extra-deps entry in stack.yaml.
Example:

in stack.yaml:

extra-deps:
- webdriver-w3c-0.0.3
$ stack ghci webdriver-w3c

Warning: Some targets (webdriver-w3c) are not local packages, and so cannot be directly loaded. In future versions of stack, this might be supported - see
         https://github.com/commercialhaskell/stack/issues/1441 . It can still be useful to specify these, as they will be passed to ghci via -package flags.

Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.
      
      You are using snapshot: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/29.yaml
      
      If you want to use package hiding and options, then you can try one of the following:
      
      * If you want to start a different project configuration than <path/to/project>stack.yaml, then you can use stack init
        to create a new stack.yaml for the packages in the current directory. 
        
      * If you want to use the project configuration at <path/to/project>stack.yaml, then you can add to its 'packages' field.
      
Configuring GHCi with the following packages: 
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help

And with the --package option:

$ stack  ghci --package webdriver-w3c
Using main module: 1. Package `<project-package>' component <project>:exe:<project>-exe with main-is file: <path/to/project>/app/Main.hs
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: <project>

As you can see, the webdriver-w3c package is totally ignored.

As I understand it, that's the problem pointed by this issue.

@nekoniaow
Copy link

nekoniaow commented Nov 3, 2022

For those who cannot wait for this feature, a functional workaround is to use the stack unpack command:

  1. comment the package entry in stack.yaml:extra-deps,
  2. add the package entry in stack.yaml:packages with its version number, in my case: -webdriver-w3c-0.0.3,
  3. run stack unpack webdriver-w3c to install the package sources locally

The package will then be part of the project and the regular ghci command will thus properly compile and load it:

$ stack ghci webdriver-w3c-0.0.3

In my case it wants the version number but I have not dug too much why that's needed. Maybe this is specific to this package and/or my setup?

This took me quite a few hours of browsing documentation and Stack Overflow to figure out so I hope this is helpful. ;)

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

No branches or pull requests

3 participants