haskell / haskell/cabal

Poorly formatted error messages with GHC HEAD

Open
#4,157 11 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

If you experience a GHC error with a recent enough GHC HEAD when building with `cabal-install`, the error messages' spacing is quite off. Here is an example:

```
$ cabal install -w ~/Software/ghc/inplace/bin/ghc-stage2
Resolving dependencies...
Notice: installing into a sandbox located at
/home/rgscott/Documents/Hacking/Haskell/bifunctors-5.4.1/.cabal-sandbox
Configuring distributive-0.5.0.2...
Failed to install distributive-0.5.0.2
Build log ( /home/rgscott/Documents/Hacking/Haskell/bifunctors-5.4.1/.cabal-sandbox/logs/distributive-0.5.0.2.log ):
cabal: Entering directory '.'
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
distributive-0.5.0.2 failed during the configure step. The exception was:
user error ('/u/rgscott/Software/ghc/inplace/bin/ghc-stage2' exited with an
error:

dist/dist-sandbox-2990f1c0/setup/setup.hs:8:31: error:
Module
‘Distribution.Package’
does not export
‘PackageName(PackageName)’
)
```

I've also seen:

```
$ cabal install -w ~/Software/ghc/inplace/bin/ghc-stage2
Resolving dependencies...
Notice: installing into a sandbox located at
/home/rgscott/Documents/Hacking/Haskell/bifunctors-5.4.1/.cabal-sandbox
Configuring distributive-0.5.0.2...
Failed to install distributive-0.5.0.2
Build log ( /home/rgscott/Documents/Hacking/Haskell/bifunctors-5.4.1/.cabal-sandbox/logs/distributive-0.5.0.2.log ):
cabal: Entering directory '.'
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
distributive-0.5.0.2 failed during the configure step. The exception was:
user error ('/u/rgscott/Software/ghc/inplace/bin/ghc-stage2' exited with an
error:

dist/dist-sandbox-2990f1c0/setup/setup.hs:38:44: error:
• Couldn't match type ‘Distribution.Package.PackageIdentifier’
with ‘PackageName’
Expected type: [(InstalledPackageId, PackageName)]
Actual type: [(InstalledPackageId, PackageId)]
• In the first argument of ‘formatdeps’, namely
‘(testDeps libcfg suitecfg)’
In the second argument of ‘($)’, namely
‘formatdeps (testDeps libcfg suitecfg)’
In the second argument of ‘(++)’, namely
‘(show $ formatdeps (testDeps libcfg suitecfg))’

dist/dist-sandbox-2990f1c0/setup/setup.hs:42:58: error:
• Couldn't match expected type ‘Data.Version.Version’
with actual type ‘Distribution.Version.Version’
NB: ‘Distribution.Version.Version’
is defined in ‘Distribution.Version’ in package ‘Cabal-1.25.0.0’
‘Data.Version.Version’
is defined in ‘Data.Version’ in package ‘base-4.9.0.0’
• In the first argument of ‘showVersion’, namely
‘(packageVersion p)’
In the second argument of ‘(++)’, namely
‘showVersion (packageVersion p)’
In the second argument of ‘(++)’, namely
‘"-" ++ showVersion (packageVersion p)’
)
```

My hunch is that this has something to do with GHC's new colorized error messages, but I'm not positive on that.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.