[GHC] #14033: Invalid newtype causes GHC to panic rather than fail to compile

GHC ghc-devs at haskell.org
Wed Jul 26 05:41:40 UTC 2017


#14033: Invalid newtype causes GHC to panic rather than fail to compile
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:  (none)
  InThisStyle10s6p                   |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           Keywords:                 |  Operating System:  Linux
       Architecture:  x86_64         |   Type of failure:  Compile-time
  (amd64)                            |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This code:
 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}

 newtype Zero = Zero
 newtype Succ a = Succ a

 type family Add n m :: * where
     Add Zero m = m
     Add (Succ n) m = Succ (Add n m)
 }}}
 causes the following GHC error:
 {{{
 $ ghc foo.hs
 [1 of 1] Compiling Main             ( foo.hs, foo.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         isInjectiveTyCon sees a TcTyCon Zero
 }}}

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


More information about the ghc-tickets mailing list