[GHC] #11485: Very unhelpful message resulting from kind mismatch

#11485: Very unhelpful message resulting from kind mismatch -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following code: {{{#!hs module Foo where import Data.Typeable tyConOf :: Typeable a => Proxy a -> TyCon tyConOf = typeRepTyCon . typeRep tcList :: TyCon tcList = tyConOf (Proxy :: Proxy []) }}} fails because `-XPolyKinds` is not enabled. But the error message that you get is quite different on GHC 7.10 and 8.0. On GHC 7.10.3: {{{ [1 of 1] Compiling Foo ( Foo.hs, Foo.o ) Foo.hs:9:19: Couldn't match kind ‘* -> *’ with ‘*’ Expected type: Proxy a0 Actual type: Proxy [] In the first argument of ‘tyConOf’, namely ‘(Proxy :: Proxy [])’ In the expression: tyConOf (Proxy :: Proxy []) In an equation for ‘tcList’: tcList = tyConOf (Proxy :: Proxy []) }}} But on GHC 8.0.1-rc1: {{{ Foo.hs:9:19: error: • Expected kind ‘Proxy []’, but ‘Data.Proxy.Proxy :: Proxy []’ has kind ‘Proxy []’ • In the first argument of ‘tyConOf’, namely ‘(Proxy :: Proxy [])’ In the expression: tyConOf (Proxy :: Proxy []) In an equation for ‘tcList’: tcList = tyConOf (Proxy :: Proxy []) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11485 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11485: Very unhelpful message resulting from kind mismatch -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: goldfire (added) Comment: goldfire, I believe the kind equalities patch caused this, so I'm CC'ing you (specifically, it's `msg5` that's causing this: http://git.haskell.org/ghc.git/blobdiff/6e56ac58a6905197412d58e32792a04a63b9...). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11485#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11485: Very unhelpful message resulting from kind mismatch -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => TypeInType -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11485#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11485: Very unhelpful message resulting from kind mismatch -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => fixed Comment: Luckily, this seems to have been fixed. As of the time of writing, GHC 8.0 gives you the following error now: {{{ $ /opt/ghc/8.0.1/bin/ghci import DtGHCi, version 8.0.0.20160406: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/ryanglscott/.ghci λ> import Data.Typeable λ> tyConOf :: Typeable a => Proxy a -> TyCon; tyConOf = typeRepTyCon . typeRep λ> tcList :: TyCon; tcList = tyConOf (Proxy :: Proxy []) <interactive>:3:36: error: • Couldn't match type ‘* -> *’ with ‘*’ Expected type: Proxy [] Actual type: Proxy [] Use -fprint-explicit-kinds to see the kind arguments • In the first argument of ‘tyConOf’, namely ‘(Proxy :: Proxy [])’ In the expression: tyConOf (Proxy :: Proxy []) In an equation for ‘tcList’: tcList = tyConOf (Proxy :: Proxy []) λ> :set -fprint-explicit-kinds λ> tcList :: TyCon; tcList = tyConOf (Proxy :: Proxy []) <interactive>:5:36: error: • Couldn't match type ‘* -> *’ with ‘*’ Expected type: Proxy * [] Actual type: Proxy (* -> *) [] • In the first argument of ‘tyConOf’, namely ‘(Proxy :: Proxy [])’ In the expression: tyConOf (Proxy :: Proxy []) In an equation for ‘tcList’: tcList = tyConOf (Proxy :: Proxy []) }}} It even tells you about `-fprint-explicit-kinds`, which makes it abundantly clear that the error resulted from a kind mismatch. Hooray! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11485#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11485: Very unhelpful message resulting from kind mismatch -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc1 checker) | Resolution: fixed | Keywords: TypeInType Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11485#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC