[GHC] #9171: Clarify error messages when there is a kind mismatch

GHC ghc-devs at haskell.org
Thu Jun 5 16:42:43 UTC 2014


#9171: Clarify error messages when there is a kind mismatch
----------------------------------------------+----------------------------
        Reporter:  MikeIzbicki                |            Owner:
            Type:  bug                        |           Status:  new
        Priority:  normal                     |        Milestone:
       Component:  Compiler                   |          Version:  7.8.2
      Resolution:                             |         Keywords:
Operating System:  Unknown/Multiple           |     Architecture:
 Type of failure:  GHC rejects valid program  |  Unknown/Multiple
       Test Case:                             |       Difficulty:  Unknown
        Blocking:                             |       Blocked By:
                                              |  Related Tickets:
----------------------------------------------+----------------------------

Comment (by rwbarton):

 Replying to [comment:3 MikeIzbicki]:

 The kind of your first `GetParam` would be `forall k3 k1 k2. k1 -> k2 ->
 k3` meaning that for each triple of kinds (k1,k2,k3), `GetParam` is a type
 function `k1 -> k2 -> k3`. It doesn't mean that for each pair of kinds
 (k1,k2) there is a kind k3 which is determined by the type family and a
 type function `k1 -> k2 -> k3`. It's like the type level `forall c a b. C
 a b c => a -> b -> c` (though it's not a perfect analogy; since type
 families can perform type-level "kind-case" but functions can't perform
 type-case, I added a type class constraint).

 Or, if you convert the polykindedness to extra arguments to the type
 family (as ghci will show you is happening behind the scenes if you `:info
 GetParam`), then your instances become
 {{{
 type instance GetParam * * * Base Int = Int
 type instance GetParam (* -> *) * * Base Int = Maybe
 }}}
 and now you can see that they don't conflict.

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


More information about the ghc-tickets mailing list