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

GHC ghc-devs at haskell.org
Sat Apr 9 15:14:31 UTC 2016


#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


More information about the ghc-tickets mailing list