[GHC] #15515: Bogus "No instance" error when type families appear in kinds

GHC ghc-devs at haskell.org
Tue Aug 14 17:26:59 UTC 2018


#15515: Bogus "No instance" error when type families appear in kinds
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler (Type    |              Version:  8.4.3
  checker)                           |             Keywords:  TypeInType,
      Resolution:                    |  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:  12564             |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * blockedby:   => 12564


Comment:

 So as far as why GHC doesn't simply error when you define `instance C (D
 :: F -> Type)`, I think it might be due to these lines in
 `check_valid_inst_head`:

 {{{#!hs
   | otherwise
   = mapM_ checkValidTypePat ty_args
   where
     ...
     ty_args = filterOutInvisibleTypes (classTyCon clas) cls_args
 }}}

 Where `checkValidTypePat` is what throws the `Illegal type synonym family
 application in instance` error seen in #12564. Because `ty_args` has
 filtered out kinds, it won't catch any type families in kinds, like in the
 original program.

 I think we could extend this error message to kinds by simply mapping
 `checkValidTypePat` over all `cls_args`, and not just `ty_args`. Do you
 agree?

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


More information about the ghc-tickets mailing list