You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stack query generates a .cabal file as side effect #6780
Yes, that is correct. stack query runs within a withBuildConfigwithEnvConfig and like other similar Stack commands (for example stack build --dry-run) that involves configuring the build environment.
Stepping back, what information is being sought? If it is not build information, then there may be a better 'home' for that functionality than stack query.
Yeah, I don't really know. This Powerlevel 10k prompt displays all kinds of useful information on the environment of the current directory (git branch name etc.), so I guess they thought, why not print the GHC version if there is a stack.yaml present in the project?
That a command named query writes new files to the local directory must be very surprising to anyone who is not an implementer of stack.
So I think there should be prominent alerts in the documentation and also in the help text:
$ stack query --help
Usage: stack query [SELECTOR...] [--setup-info-yaml URL]
[--snapshot-location-base URL]
Query general build information (experimental).
Available options: ...
The expected behavior of stack query compiler would be that it extracts the resolver/snapshot from the stack.yaml file, computes the ghc version from this and prints it.
Apparently just a stack.yaml is not enough:
$ stack query compiler
Error: [S-636]
Stack looks for packages in the directories configured in the packages and extra-deps fields defined in its project-level configuration file (usually
stack.yaml). The current entry points to /Users/abela/tmp/stack-query-compiler-no-package-yaml/ but no Cabal file or package.yaml could be found there.
I think at this point it might be enough to add the alert to the documentation, to make potential users of the stack query command aware of the consequences.
I suppose the authors of the shell prompt would have refrained from adding a hook for stack if they had known about the consequences of running stack query.
@andreasabel, there is a nuance to 'compiler' information: 'wanted' versus 'actual'. 'Wanted' is what is specified in the project-level configuration file and at the command line. 'Actual' is what is used. They can differ because of compiler-check options.
A BuildConfig value has information about 'wanted' (via its smWanted field).
A EnvConfig value also has information about 'actual' (via its sourceMap field).
I think it would be straightforward to add a stack ls compiler command that output the 'wanted' compiler but did not configure the build environment.
I think it would be straightforward to add a stack ls compiler command that output the 'wanted' compiler but did not configure the build environment.
Good.
I am not in a position to request this feature, though, as I do not have an application for it right now, and the "Powerlevel 10k" folks might not be actively developing their product anymore, given the disclaimer on their github repo.
Activity
mpilgrem commentedon Aug 7, 2025
Yes, that is correct.
stack queryruns within awithBuildConfigwithEnvConfigand like other similar Stack commands (for examplestack build --dry-run) that involves configuring the build environment.Stepping back, what information is being sought? If it is not build information, then there may be a better 'home' for that functionality than
stack query.andreasabel commentedon Aug 8, 2025
Yeah, I don't really know. This Powerlevel 10k prompt displays all kinds of useful information on the environment of the current directory (git branch name etc.), so I guess they thought, why not print the GHC version if there is a
stack.yamlpresent in the project?That a command named
querywrites new files to the local directory must be very surprising to anyone who is not an implementer ofstack.So I think there should be prominent alerts in the documentation and also in the help text:
The expected behavior of
stack query compilerwould be that it extracts the resolver/snapshot from thestack.yamlfile, computes the ghc version from this and prints it.Apparently just a
stack.yamlis not enough:I think at this point it might be enough to add the alert to the documentation, to make potential users of the
stack querycommand aware of the consequences.I suppose the authors of the shell prompt would have refrained from adding a hook for
stackif they had known about the consequences of runningstack query.mpilgrem commentedon Aug 8, 2025
@andreasabel, there is a nuance to 'compiler' information: 'wanted' versus 'actual'. 'Wanted' is what is specified in the project-level configuration file and at the command line. 'Actual' is what is used. They can differ because of
compiler-checkoptions.A
BuildConfigvalue has information about 'wanted' (via itssmWantedfield).A
EnvConfigvalue also has information about 'actual' (via itssourceMapfield).I think it would be straightforward to add a
stack ls compilercommand that output the 'wanted' compiler but did not configure the build environment.andreasabel commentedon Aug 9, 2025
Good.
I am not in a position to request this feature, though, as I do not have an application for it right now, and the "Powerlevel 10k" folks might not be actively developing their product anymore, given the disclaimer on their github repo.