[GHC] #7939: RHS of associated type not kind-checked

GHC ghc-devs at haskell.org
Fri Jun 21 19:13:49 CEST 2013


#7939: RHS of associated type not kind-checked
------------------------------------------+---------------------------------
  Reporter:  goldfire                     |          Owner:                  
      Type:  bug                          |         Status:  new             
  Priority:  normal                       |      Milestone:                  
 Component:  Compiler                     |        Version:  7.7             
Resolution:                               |       Keywords:                  
        Os:  Unknown/Multiple             |   Architecture:  Unknown/Multiple
   Failure:  GHC accepts invalid program  |     Difficulty:  Unknown         
  Testcase:  ghci/scripts/T7939           |      Blockedby:                  
  Blocking:                               |        Related:                  
------------------------------------------+---------------------------------

Comment(by simonpj):

 Well analysed.

  * The inconsistency seems to be deliberate; look at
 `TcTyClDecls.getFamDeclInitialKind`.  But there is no explanation of why
 the difference, so I think we should abolish the difference until proved
 otherwise.

  * With `-XPolyKinds` we get kind polymorphism by default in data decls.
 Eg
 {{{
 data T f a = MkT (f a)
 }}}
   we get `T :: (k -> *) -> k -> *`.

  * By the same token it is perhaps reasonable that
 {{{
 type family F a :: *
 }}}
   gives `F :: k -> *`

  * But getting polykinded ''result'' kind by default (even with
 `-XPolyKinds`) seems odd to me:
 {{{
 type family F a
 }}}
   Do we really want `F :: k1 -> k2`?

 My suggestion is that we adopt the current top-level story, namely that
 the result kind of a type family is `*` unless you explicitly use a kind
 variable.  That's inconsistent with the argument story, but the examples
 you give above really are quite confusing

 Comments, anyone?  The fix is easy either way.

 Simon

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



More information about the ghc-tickets mailing list