[GHC] #9547: Empty constraint tuples are mis-kinded

GHC ghc-devs at haskell.org
Wed Sep 3 21:31:00 UTC 2014


#9547: Empty constraint tuples are mis-kinded
-------------------------------------+-------------------------------------
       Reporter:  simonpj            |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.2
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 Consider
 {{{
 -- If :: forall k. 'Bool -> k -> k -> k
 type family If cond tru fls where
    If True tru fls = tru
    If False tru fls = fls

 foo :: If True () (Eq a) => a -> a
 foo = error "urk"
 }}}
 This should work fine. But we get
 {{{
 Foo.hs:8:21:
     The third argument of `If' should have kind `*',
       but `Eq a' has kind `Constraint'
     In the type signature for `foo': foo :: If True () (Eq a) => a -> a
 }}}
 Reason: GHC is treating the `()` unit tuple as of kind `*`.

 Reason is that in the `HsTupleTy` case of `tc_hs_type` in `TcHsType`, we
 see
 {{{
          -- In the [] case, it's not clear what the kind is, so guess *
 }}}
 And that guess is plain wrong in this case.  Unfortunately I don't see an
 easy fix, but it's plain wrong as-is.

 Simon

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


More information about the ghc-tickets mailing list