[GHC] #13297: Panic when deriving Applicative instance through transformer

GHC ghc-devs at haskell.org
Sat Feb 18 22:11:49 UTC 2017


#13297: Panic when deriving Applicative instance through transformer
-------------------------------------+-------------------------------------
           Reporter:  blaze          |             Owner:  (none)
               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:
-------------------------------------+-------------------------------------
 I'm not sure if code below is valid, but panic is wrong anyway.

 {{{#!hs
 {-# Language TypeFamilies, StandaloneDeriving, GeneralizedNewtypeDeriving,
 UndecidableInstances #-}
 module Example where

 newtype N p m a = N (((CT p) m) a)
 deriving instance (CT p ~ f, Functor (f m)) => Functor (N p m)
 deriving instance (CT p ~ f, Applicative (f m)) => Applicative (N p m) --
 panic when this line added

 class C p where
     type CT p :: (* -> *) -> * -> *
 }}}

 Compiler output for 8.0.1 and 8.0.2 is slightly different:
 {{{
 test.hs:6:1: error:ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.1 for x86_64-unknown-linux):
         No skolem info: f1_auk[sk]
 }}}
 {{{
 test.hs:6:1: error:ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.2 for x86_64-unknown-linux):
         No skolem info: f1_aun[sk]
 }}}
 If I try to derive only Functor instance, code compiles just fine.

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


More information about the ghc-tickets mailing list