[GHC] #13806: Invalid usage of TypeFamilies cause GHC Internal Error

GHC ghc-devs at haskell.org
Fri Jun 9 01:47:55 UTC 2017


#13806: Invalid usage of TypeFamilies cause GHC Internal Error
-------------------------------------+-------------------------------------
           Reporter:  utdemir        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I couldn't be able to reproduce this with a valid program, but seeing "GHC
 internal error" was surprising. Only the second error should be enough in
 this case.

 {{{
 $ cat test.hs
 {-# LANGUAGE TypeFamilies #-}

 data Foo value
   = Foo (T value)

 class Cl t where
   type T
   mk :: t -> T

 main :: IO ()
 main = undefined


 $ runhaskell test.hs

 test.hs:4:10: error:
     • GHC internal error: ‘T’ is not in scope during type checking, but it
 passed the renamer
       tcl_env of environment: [a10K :-> Type variable ‘value’ = value,
                                r10F :-> ATcTyCon Foo, r10G :->
 APromotionErr RecDataConPE]
     • In the type ‘T value’
       In the definition of data constructor ‘Foo’
       In the data declaration for ‘Foo’

 test.hs:6:1: error:
     • The associated type ‘T’
       mentions none of the type or kind variables of the class ‘Cl t’
     • In the class declaration for ‘Cl’


 $ runhaskell --version
 runghc 8.0.2
 }}}

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


More information about the ghc-tickets mailing list