Skip to content

Add more queries to stack query#3761

Merged
mgsloan merged 2 commits intocommercialhaskell:masterfrom
serokell:query-more
Jan 20, 2018
Merged

Add more queries to stack query#3761
mgsloan merged 2 commits intocommercialhaskell:masterfrom
serokell:query-more

Conversation

@kirelagin
Copy link
Copy Markdown
Contributor

While looking into input-output-hk/stack2nix#84 I added a couple of queries to stack query, so I thought I’d share them in case someone finds them useful.

The change is pretty trivial, but if I had access to a Windows machine, I would make sure it still compiles on Windows, just in case.

@mgsloan
Copy link
Copy Markdown
Contributor

mgsloan commented Jan 20, 2018

Hi, sorry for letting this languish! It seems good to have this information, thanks for adding it

Not sure about the names, just because we're not going to want to change them in the future. But I can't think of better ones, so going ahead to merge.

@mgsloan mgsloan merged commit bf4d4ae into commercialhaskell:master Jan 20, 2018
@mgsloan
Copy link
Copy Markdown
Contributor

mgsloan commented Jan 20, 2018

Hmm, why is global-hints needed? That seems like a bit of an internal stack concern that may change in the future. stack query should probably have a configuration.packages field that gives a dump of the packages in the configuration. I've opened #3796

@kirelagin
Copy link
Copy Markdown
Contributor Author

I was working on stack2nix and I was looking for a way to get a list of the packages bundled with the GHC version used in the resolver. Global hints seemed to be the closest I could get... Is there something better?

@mgsloan
Copy link
Copy Markdown
Contributor

mgsloan commented Jan 20, 2018

Hmm, do you need this information before installing ghc? If not, then using stack exec -- ghc-pkg dump along with stack path --global-pkg-db can tell you what's in the package db.

@kirelagin
Copy link
Copy Markdown
Contributor Author

Ideally, yes.

(I’m not sure now why I rejected the idea of installing the raw compiler and querying its database, I’ll have to thing about it again.)

@mgsloan
Copy link
Copy Markdown
Contributor

mgsloan commented Jan 20, 2018

Yeah, that's why these are "hints". It will let you use whatever global packages that come with the compiler. I actually don't remember what they are used for.

@kirelagin
Copy link
Copy Markdown
Contributor Author

AFAIU they are used for stack init, at least according to this post by @snoyberg, which is where I got the idea of using them to approximate the set of boot packages.

@kirelagin kirelagin deleted the query-more branch January 20, 2018 11:41
@snoyberg
Copy link
Copy Markdown
Contributor

They're only used as a hack because we want to guess which snapshot to use, and not require the user to install 3 GHCs to do that guessing. Wherever possible, you should use the actual global database from GHC, which will handle cases like different OSes and prerelease/custom compilers properly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants