Motivation from chat logs:
What is the simplest way to get stack to generate a cabal file from
package.yamlwithout building? I could do that usingstack query, but is there a better/canonical way to do it?
stack build --dry-runwill do it. I've wished for astack hpackcommand myself.
I believe that despite its name, stack build --dry-run will invoke hpack. If the hpack exe is installed, I think you can also do stack exec hpack.
Is that sufficient? Should it be documented? Not sure it's worth a new command.
stack build --dry-run seems to work for me (it generates a .cabal file). The advantage of stack hpack is that it would use the _same_ version of hpack that Stack is built with, vs stack exec hpack which would use whatever version was last installed (if that's older than stack's, it will complain that the .cabal file was generated with a newer version of hpack, and if it's newer it will cause stack to make the same complaint).
I suppose there isn't much of an overhead to adding such aliases for common stuff.
Somewhat off topic, but I would also like stack ghc-pkg -- as a slightly more convenient way to run stack exec -- ghc-pkg
What was the resolution here? stack build --dry-run does more than just run hpack
I also encountered situations where something like stack hpack is necessary. I want to avoid that stack build --dry-run does setup, because it takes extra time especially when using nix integration.
Most helpful comment
What was the resolution here?
stack build --dry-rundoes more than just runhpack