{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/1169","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1169/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1169/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1169/events","html_url":"https://github.com/commercialhaskell/stack/issues/1169","id":111701886,"number":1169,"title":"Fast way to get GHC version for a given project","user":{"login":"DanielG","id":199218,"avatar_url":"https://avatars.githubusercontent.com/u/199218?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielG","html_url":"https://github.com/DanielG","followers_url":"https://api.github.com/users/DanielG/followers","following_url":"https://api.github.com/users/DanielG/following{/other_user}","gists_url":"https://api.github.com/users/DanielG/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielG/subscriptions","organizations_url":"https://api.github.com/users/DanielG/orgs","repos_url":"https://api.github.com/users/DanielG/repos","events_url":"https://api.github.com/users/DanielG/events{/privacy}","received_events_url":"https://api.github.com/users/DanielG/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-15T20:34:41Z","updated_at":"2015-10-16T04:19:04Z","closed_at":null,"body":" I would like to be able to check the GHC version a given stack project is using in ghc-mod, but `stack exec -- ghc --numeric-version` takes around 100ms on my machine which is quite a lot of latency for an action that we will have to run on every command (for the non daemon version of ghc-mod). I think stack should already know internally which GHC version it's going to use given a project's resolver so adding a command to print this should be really easy, right?\r\n \r\nAlso is there a way to print a list of known resolver versions and the corresponding GHC versions?"},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/148596263","html_url":"https://github.com/commercialhaskell/stack/issues/1169#issuecomment-148596263","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1169","id":148596263,"user":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T04:19:04Z","updated_at":"2015-10-16T04:19:04Z","body":"The reason this is taking 100ms is actually necessary most likely: Stack has to:\r\n\r\n1. Check for GHC on the PATH\r\n2. Ask that GHC to report its version\r\n3. If no GHC is found, or the GHC doesn't match:\r\n    a. Search its internal installed GHC list for a match\r\n    b. Optionally perform the numeric-version sanity check on it\r\n\r\nYou may say \"but we already know the exact version of GHC we're going to be using!\" But that's not actually true: we know the version of GHC that was used to build the snapshot, but users have control over tweaking that to allow for newer GHC minor versions, patch releases, or even completely different versions. This full check is the only way to be certain what the user is going to be using."}}