Bizarre pretty-printing of inferred Coercible constraint in partial type signature
Consider the following GHCi session:
$ ghci
GHCi, version 8.4.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
λ> import Data.Type.Coercion
λ> foo :: _ => Coercion a b; foo = Coercion
<interactive>:2:8: error:
• Found type wildcard ‘_’
standing for ‘Coercible a b :: TYPE ('GHC.Types.TupleRep '[])’
Where: ‘a’, ‘b’ are rigid type variables bound by
the inferred type of foo :: Coercible a b => Coercion a b
at <interactive>:2:27-40
To use the inferred type, enable PartialTypeSignatures
• In the type signature: foo :: _ => Coercion a b
λ> :set -fprint-explicit-kinds
λ> foo :: _ => Coercion a b; foo = Coercion
<interactive>:4:8: error:
• Found type wildcard ‘_’
standing for ‘(a :: *) ~~ (b :: *) :: TYPE
('GHC.Types.TupleRep ('[] GHC.Types.RuntimeRep))’
Where: ‘a’, ‘b’ are rigid type variables bound by
the inferred type of
foo :: ((a :: *) ~~ (b :: *)) => Coercion * a b
at <interactive>:4:27-40
To use the inferred type, enable PartialTypeSignatures
• In the type signature: foo :: _ => Coercion a b
There are two things quite strange about this:
- In both error messages, GHC claims that
Coercible a b
/a ~~ b
has kindTYPE (TupleRep '[])
. This is wrong, and should beCoercible
. - For some reason, enabling
-fprint-explicit-kinds
causes the inferred constraint to be(~~)
instead ofCoercible
, which is just plain wrong.
Trac metadata
Trac field | Value |
---|---|
Version | 8.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |