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

stack init doesn't work with internal libraries #4408

chshersh opened this issue Nov 20, 2018 · 7 comments

stack init doesn't work with internal libraries #4408

chshersh opened this issue Nov 20, 2018 · 7 comments


Copy link

General summary/comments (optional)

I'm trying to call stack init command over the package with internal libraries. This is one of the steps for adding package to Stackage. Unfortunately, this command fails with error that the internal library is not found on Stackage.

Steps to reproduce

stack unpack typerep-map-0.3.0
cd typerep-map-0.3.0
stack init --resolver nightly

The last step fails and I don't see created stack.yaml. However, if I run:

echo "resolver: nightly-2018-11-20" > stack.yaml

I can build the package without problems with stack build command.


Successful creation of stack.yaml.


$ stack init --resolver nightly --verbose
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0
2018-11-20 17:12:03.105062: [info] Looking for .cabal or package.yaml files to use to init the project.
2018-11-20 17:12:03.107194: [info] Using cabal packages:
2018-11-20 17:12:03.107243: [info] - ./

2018-11-20 17:12:03.111779: [debug] Downloading snapshot versions file from
2018-11-20 17:12:04.466083: [debug] Done downloading and parsing snapshot versions file
2018-11-20 17:12:04.466210: [info] Selected resolver: nightly-2018-11-20
2018-11-20 17:12:04.466371: [debug] Decoding build plan from: /Users/fenx/.stack/build-plan/nightly-2018-11-20.yaml
2018-11-20 17:12:04.466461: [debug] Trying to decode /Users/fenx/.stack/build-plan-cache/nightly-2018-11-20.cache
2018-11-20 17:12:04.469162: [debug] Success decoding /Users/fenx/.stack/build-plan-cache/nightly-2018-11-20.cache
2018-11-20 17:12:04.469259: [info] Selected resolver: nightly-2018-11-20
2018-11-20 17:12:04.469365: [debug] Trying to decode /Users/fenx/.stack/loaded-snapshot-cache/x86_64-osx/__snapshot_hints__/nightly-2018-11-20.cache
2018-11-20 17:12:04.497030: [debug] Success decoding /Users/fenx/.stack/loaded-snapshot-cache/x86_64-osx/__snapshot_hints__/nightly-2018-11-20.cache
Resolver 'nightly-2018-11-20' does not have all the packages to match your requirements.
    typerep-extra-impls not found
        - typerep-map requires -any

This may be resolved by:
    - Using '--solver' to ask cabal-install to generate extra-deps, atop the chosen snapshot.
    - Using '--omit-packages to exclude mismatching package(s).
    - Using '--resolver' to specify a matching snapshot/resolver

Stack version

$ stack --version
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0

Method of installation

  • Official binary, downloaded from or fpcomplete's package repository
Copy link

Right, it's treating typerep-map-impls as a package, not as a library.

Am I correct in thinking you cannot use stack init at all, even if you create a stub stack.yaml with the resolver as you do for your demonstration that build works?

@mihaimaruseac probably knows the most about internal libraries support — Mihai?

Copy link

@dbaynard After creating stack.yaml file with my command I cannot use stack init as well because it complains that stack.yaml is already exist.

Control.Exception.Safe.throwString called with:

Error: Stack configuration file stack.yaml exists, use 'stack solver' to fix the existing config file or '--force' to overwrite it.
Called from:
  throwString (src/Stack/Init.hs:64:9 in stack-1.9.1-3pkMneYlY9yXBwwTVoQza:Stack.Init)

As this moment I'm mostly interested in whether I can still add my package to Stackage or not because it build without problems with stack and other libraries, that depend on it, also build with stack.

Copy link

Sorry for the delay in answering, been AFK most of the past week.

Afaik, you can always write a stack.yaml file by hand and no need to stack init again after that.

I guess I missed something in the Stack code for stack init regarding internal libraries, I'll try to give this a look but it will be a while until I can land a fix.

Copy link

@mihaimaruseac I'm okay with writing stack.yaml by hand. But this issue blocks adding typerep-map package to Stackage:

Copy link

Oh, that's a different bug, for a different tool. We'll need to patch that too.

I won't be able to land a fix this week, as I'm already late in releasing HCAR and will have to push on that first. But hopefully in 2 or 3 weeks?

Copy link

@mihaimaruseac Works for me! Thank you for your effort ❤️

Copy link

snoyberg commented Apr 1, 2019

Should be addressed by #4675

snoyberg added a commit that referenced this issue Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

4 participants