[GHC] #14390: Panic when defining an instance for (~~) [ppr_equality: homogeneity]

GHC ghc-devs at haskell.org
Wed Oct 25 22:27:27 UTC 2017


#14390: Panic when defining an instance for (~~) [ppr_equality: homogeneity]
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Compile-time
  Unknown/Multiple                   |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In GHC 8.2.1 and HEAD, compiling this file panics:

 {{{#!hs
 import Data.Type.Equality
 instance (~~) Int Int
 }}}

 {{{
 $ /opt/ghc/8.2.1/bin/ghc Bug.hs
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )

 Bug.hs:2:10: error:ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.1 for x86_64-unknown-linux):
         ppr_equality: homogeneity
   ~~
   Call stack:
       CallStack (from HasCallStack):
         prettyCurrentCallStack, called at
 compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
         callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in
 ghc:Outputable
         pprPanic, called at compiler/iface/IfaceType.hs:1008:31 in
 ghc:IfaceType
 }}}

 We should probably give a similar error as for when one attempts to define
 an instance for `(~)`:

 {{{#!hs
 instance (~) Int Int
 }}}

 {{{
 $ /opt/ghc/8.2.1/bin/ghc Bug.hs
 [1 of 1] Compiling Main             ( Bug.hs, Bug.o )

 Bug.hs:1:10: error:
     • Illegal instance declaration for ‘Int ~ Int’
         Manual instances of this class are not permitted.
     • In the instance declaration for ‘(~) Int Int’
   |
 1 | instance (~) Int Int
   |          ^^^^^^^^^^^
 }}}

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


More information about the ghc-tickets mailing list