[GHC] #9017: Confusing error message with PolyKinds

GHC ghc-devs at haskell.org
Sat Dec 12 03:05:07 UTC 2015


#9017: Confusing error message with PolyKinds
-------------------------------------+-------------------------------------
        Reporter:  edsko             |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.8.2
  checker)                           |
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
                                     |  polykinds/T9017
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * testcase:   => polykinds/T9017
 * status:  new => closed
 * resolution:   => fixed


Comment:

 This test case still produces a suboptimal message:

 {{{
 T9017.hs:8:7: error:
     • Couldn't match kind ‘k’ with ‘*’
       ‘k’ is a rigid type variable bound by
         the type signature for:
           foo :: forall k k1 (a :: k1 -> k -> *) (b :: k1) (m :: k1 -> k).
                  a b (m b)
         at T9017.hs:7:8
       When matching the kind of ‘a’
     • In the expression: arr return
       In an equation for ‘foo’: foo = arr return
     • Relevant bindings include
         foo :: a b (m b) (bound at T9017.hs:8:1)

 T9017.hs:8:7: error:
     • Couldn't match kind ‘k1’ with ‘*’
       ‘k1’ is a rigid type variable bound by
         the type signature for:
           foo :: forall k k1 (a :: k1 -> k -> *) (b :: k1) (m :: k1 -> k).
                  a b (m b)
         at T9017.hs:7:8
       When matching the kind of ‘a’
     • In the expression: arr return
       In an equation for ‘foo’: foo = arr return
     • Relevant bindings include
         foo :: a b (m b) (bound at T9017.hs:8:1)
 }}}

 We get two duplicate messages, and it's still quite hard to see what's
 going on.

 Actually, a little more thought tells me the messages aren't quite
 duplicates: the kind-generalized type signature contains two different
 kind variables, both of which are distinct from `*`. With the type
 signature given, I think it's OK. I'm going to accept this output, but
 shout if you see a way to improve.

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


More information about the ghc-tickets mailing list