Incorrect parenthesization of type in error message
If you compile this program:
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE GADTs #-}
import GHC.Exts (Constraint)
data Dict a where
Dict :: a => Dict a
foo :: Dict (Int ~ Int) => Int
foo = undefined
In GHC 8.0.1, 8.0.2, 8.2.1, or HEAD, it will give this error message:
GHCi, version 8.3.20170509: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main ( Bug2.hs, interpreted )
Bug2.hs:9:8: error:
• Expected a constraint, but ‘Dict Int ~ Int’ has kind ‘*’
• In the type signature: foo :: Dict (Int ~ Int) => Int
|
9 | foo :: Dict (Int ~ Int) => Int
| ^^^^^^^^^^^^^^^^
But Dict Int ~ Int
is not parenthesized correctly!
This is a regression, as GHC 7.10.3 and earlier parenthesize it correctly:
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( Bug2.hs, interpreted )
Bug2.hs:9:8:
Expected a constraint, but ‘Dict (Int ~ Int)’ has kind ‘*’
In the type signature for ‘foo’: foo :: Dict (Int ~ Int) => Int
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |