[GHC] #12589: GHC panic with defer-typed-holes

GHC ghc-devs at haskell.org
Sun Sep 11 09:00:45 UTC 2016


#12589: GHC panic with defer-typed-holes
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Does this still happen in HEAD?


 {{{#!hs
 import qualified GHC.Generics as GHC
 import Generics.SOP
 import Generics.SOP.TH
 import Data.Proxy

 gminbound' :: (Generic a, Code a ~ (xs:xss), All2 Bounded (Code a)) => a
 gminbound' = minBound
   & I
   & hcpure (Proxy @Bounded)
   & apInjs_POP
   & head
   & to
 }}}

 Fails but doesn't crash with

 {{{
 $ ghci -ignore-dot-ghci -XTypeApplications -XTypeOperators -XDataKinds
 -XGADTs -XFlexibleContexts /tmp/tX96.hs
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( /tmp/tX96.hs, interpreted )

 /tmp/tX96.hs:8:3: error:
     Variable not in scope: (&) :: t4 -> (a0 -> I a0) -> t3

 /tmp/tX96.hs:9:3: error:
     Variable not in scope: (&) :: t3 -> t5 -> t2

 /tmp/tX96.hs:10:3: error:
     Variable not in scope:
       (&) :: t2 -> (POP f1 xss0 -> [SOP f1 xss0]) -> t1

 /tmp/tX96.hs:11:3: error:
     Variable not in scope: (&) :: t1 -> ([a1] -> a1) -> t0

 /tmp/tX96.hs:12:3: error:
     Variable not in scope: (&) :: t0 -> (Rep a2 -> a2) -> a
 Failed, modules loaded: none.
 Prelude>
 }}}

 but crashes with `-fdefer-typed-holes`

 {{{
 $ ghci -ignore-dot-ghci -fdefer-typed-holes -XTypeApplications
 -XTypeOperators -XDataKinds -XGADTs -XFlexibleContexts /tmp/tX96.hs
 GHCi, version 8.0.1: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( /tmp/tX96.hs, interpreted )

 /tmp/tX96.hs:8:3: warning: [-Wtyped-holes]
     Variable not in scope: (&) :: t4 -> (a0 -> I a0) -> t3

 /tmp/tX96.hs:9:3: warning: [-Wtyped-holes]
     Variable not in scope: (&) :: t3 -> t5 -> t2

 /tmp/tX96.hs:10:3: warning: [-Wtyped-holes]
     Variable not in scope:
       (&) :: t2 -> (POP f1 xss0 -> [SOP f1 xss0]) -> t1

 /tmp/tX96.hs:11:3: warning: [-Wtyped-holes]
     Variable not in scope: (&) :: t1 -> ([a1] -> a1) -> t0

 /tmp/tX96.hs:12:3: warning: [-Wtyped-holes]
     Variable not in scope: (&) :: t0 -> (Rep a2 -> a2) -> a
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.0.1 for x86_64-unknown-linux):
         opt_univ fell into a hole {aabX}

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 >
 }}}

 ----

 More minimal example, still requires [https://hackage.haskell.org/package
 /generics-sop-0.2.2.0 generics-sop]:

 {{{#!hs
 import Generics.SOP

 a = minBound
   & hcpure (Proxy @Bounded)
 }}}

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


More information about the ghc-tickets mailing list