[GHC] #14230: Gruesome kind mismatch errors for associated data family instances

GHC ghc-devs at haskell.org
Thu Nov 29 19:38:55 UTC 2018


#14230: Gruesome kind mismatch errors for associated data family instances
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.8.1
       Component:  Compiler (Type    |              Version:  8.3
  checker)                           |
      Resolution:                    |             Keywords:  TypeInType
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14175            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 By gum, this might just be fixed. On GHC HEAD (commit
 2257a86daa72db382eb927df12a718669d5491f8), we get the following error
 message for the first program:

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

 ../Bug.hs:11:3: error:
     • Type indexes must match class instance head
       Expected: CD @(Maybe a)
         Actual: CD @(k -> *) -- Defined at ../Bug.hs:11:8
     • In the data instance declaration for ‘CD’
       In the instance declaration for ‘C (Maybe a)’
    |
 11 |   data CD :: (k -> *) -> (k -> *) -> *
    |   ^^^^^^^
 }}}

 And the following error message for the second program:

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

 ../Bug.hs:13:14: error:
     • Expected kind ‘k -> *’, but ‘a’ has kind ‘*’
     • In the second argument of ‘CD’, namely ‘(a :: k -> *)’
       In the data instance declaration for ‘CD’
       In the instance declaration for ‘C (Maybe a)’
    |
 13 |   data CD k (a :: k -> *) :: (k -> *) -> *
    |              ^
 }}}

 Both of those look like pretty cromulent error messages to me. Should we
 check in test cases and declare victory?

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


More information about the ghc-tickets mailing list