[GHC] #13971: Misleading "Kind mis-match on LHS of default declaration" error

GHC ghc-devs at haskell.org
Thu Jul 13 17:04:29 UTC 2017


#13971: Misleading "Kind mis-match on LHS of default declaration" error
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
  (Type checker)                     |
           Keywords:  TypeFamilies   |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Poor/confusing
  Unknown/Multiple                   |  error message
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This program fails to typecheck, unsurprisingly:

 {{{#!hs
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE TypeFamilies #-}
 module Bug where

 class C a where
   type T a :: k
   type T a = Int
 }}}

 But the error message it gives threw me for a loop initially:

 {{{
 $ /opt/ghc/8.2.1/bin/ghci Bug.hs
 GHCi, version 8.2.0.20170704: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )

 Bug.hs:7:3: error:
     • Kind mis-match on LHS of default declaration for ‘T’
     • In the default type instance declaration for ‘T’
       In the class declaration for ‘C’
   |
 7 |   type T a = Int
   |   ^^^^^^^^^^^^^^
 Failed, 0 modules loaded.
 }}}

 The LHS of the default declaration is perfectly fine - the real source of
 the error is the RHS!

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13971>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list