haskell/hie-bios

`cabal path` fails with cabal HEAD

Aberta

#485 aberto em 17 de nov. de 2025

 (0 comentário) (0 reação) (0 responsável)Haskell (70 forks)auto 404
good first issue

Métricas do repositório

Stars
 (198 estrelas)
Métricas de merge de PR
 (Mesclagem média 12d 14h) (2 fundiu PRs em 30d)

Description

If you use cabal HEAD, or any local install, often you use a debug installation of cabal. In this case, cabal will output the warning:

Warning: this is a debug build of cabal-install with assertions enabled.

for each cli invocation. This output warning can't be silenced.

With this output, the output of cabal path is unexpectedly not a valid json object. Thus, hie-bios can't find the ghc options and renders HLS inoperable with cabal HEAD installations that have assertions enabled.

The solution is to invoke cabal path --output-format=json -vnormal+markoutput and parse the last output block:

> cabal path --output-format=json -vnormal+markoutput
-----BEGIN CABAL OUTPUT-----
Configuration is affected by the following files:
- cabal.project
-----END CABAL OUTPUT-----
-----BEGIN CABAL OUTPUT-----
{"cabal-version":"3.14.2.0","compiler":{"flavour":"ghc","id":"ghc-9.10.3","path":"/home/hugin/.ghcup/bin/ghc"},"cache-home":"/home/hugin/.cache/cabal","remote-repo-cache":"/home/hugin/.cache/cabal/packages","logs-dir":"/home/hugin/.cache/cabal/logs","store-dir":"/home/hugin/.local/state/cabal/store","config-file":"/home/hugin/.config/cabal/config","installdir":"/home/hugin/.local/bin"}
-----END CABAL OUTPUT-----

Guia do colaborador