cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Add the cabal store ghc sub-directory to `cabal path` output

Open phadej opened this issue 1 year ago • 3 comments

% cabal-3.12.1.0 path                                            
compiler-flavour: ghc
compiler-id: ghc-9.2.8
compiler-path: /opt/ghcup/.ghcup/bin/ghc
cache-home: /home/phadej/.cache/cabal
remote-repo-cache: /cabal/packages
logs-dir: /cabal/logs
store-dir: /cabal/store
config-file: /cabal/config
installdir: /cabal/bin

However due https://github.com/haskell/cabal/pull/9326, this information is not enough to find the ghc specific store directory, which is /caba/store/ghc-9.8.2-6af5 for GHC-9.8.2 I have.

phadej avatar Jul 01 '24 19:07 phadej

Found a one liner:

$ ghc --info | ghci -e 'readFile "/dev/stdin" >>= putStrLn . snd . (!! 0) . filter ((== "Project Unit Id"). fst) . (read :: String -> [(String, String)])'
ghc-9.10.1-0348

hellwolf avatar May 11 '25 18:05 hellwolf

Sounds like a great addition to the cabal path command.

fendor avatar May 11 '25 20:05 fendor

Yea, I think it should be part of the path command.

hellwolf avatar May 12 '25 12:05 hellwolf