[GHC] #15598: RebindableSyntax with RankNTypes and type class method call yields panic.

GHC ghc-devs at haskell.org
Mon Sep 3 16:11:56 UTC 2018


#15598: RebindableSyntax with RankNTypes and type class method call yields panic.
-------------------------------------+-------------------------------------
        Reporter:  romanb            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
                                     |  RebindableSyntax, RankNTypes
Operating System:  Linux             |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash or panic                     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  14963             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 I think you are right in connecting it with #14963.  But your example here
 is nothing to do with GHCi, nor with `-fdefer-type-errors`, so it's
 helpful.

 Lint complains immediately
 {{{
 *** Core Lint errors : in result of Desugar (before optimization) ***
 <no location info>: warning:
     In the expression: show @ Int $dShow_a1rx (I# 42#)
     $dShow_a1rx :: Show Int
     [LclId] is out of scope
 *** Offending Program ***
 Rec {
 $dMonad_a1rX :: Monad IO
 [LclId]
 $dMonad_a1rX = $fMonadIO

 $tcInfDo :: TyCon
 [LclIdX]
 $tcInfDo
   = TyCon
       14827517540190131426##
       17869035366104385648##
       $trModule
       (TrNameS "InfDo"#)
       0#
       krep$*

 $trModule :: Module
 [LclIdX]
 $trModule = Module (TrNameS "main"#) (TrNameS "T15598"#)

 prog :: InfDo
 [LclIdX]
 prog
   = letrec {
       >>=_aW0 :: String -> (forall a. a -> InfDo) -> InfDo
       [LclId]
       >>=_aW0
         = letrec {
             >>=_a1ri :: String -> (forall a. a -> InfDo) -> InfDo
             [LclId]
             >>=_a1ri = InfDo; } in
           >>=_a1ri; } in
     >>=_aW0
       (show @ Int $dShow_a1rx (I# 42#))
       (\ (@ a_a1rp) ->
          let {
            $dShow_a1rx :: Show Int
            [LclId]
            $dShow_a1rx = $fShowInt } in
          \ (ds_d1De :: a_a1rp) -> prog)

 main :: IO ()
 [LclIdX]
 main
   = letrec {
       x_a1ca :: InfDo
       [LclId]
       x_a1ca
         = letrec {
             x_a1rI :: InfDo
             [LclId]
             x_a1rI = prog; } in
           x_a1rI; } in
     case x_a1ca of x_a1ca { __DEFAULT ->
     return @ IO $dMonad_a1rX @ () ()
     }
 end Rec }

 *** End of Offense ***
 }}}
 This is pretty bad.  It's all in `tcSyntaxOp`, I believe.

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


More information about the ghc-tickets mailing list