#4169: TH vs. default function implementation: internal error
---------------------------------+------------------------------------------
    Reporter:  verdelyi          |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.12.3            |    Keywords:              
          Os:  Unknown/Multiple  |    Testcase:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 Testcase:
 {{{
 {-# LANGUAGE TemplateHaskell #-}
 import Language.Haskell.TH
 class Numeric a where
     fromIntegerNum :: a
     fromIntegerNum = undefined

 ast :: Q [Dec]
 ast = [d|
     instance Numeric Int
     |]
 }}}
 It gives an internal error:

 {{{
 InstanceGenerator.hs:9:13:
     GHC internal error: `Main.$dmfromIntegerNum' is not in scope during
 type checking, but it passed the renamer
     tcg_type_env of environment: [(rgd, Class `Numeric'),
                                   (rgf, Identifier `fromIntegerNum'),
                                   (rgm, Data constructor
 `Main.D:Numeric'),
                                   (rgn, Type constructor
 `Main.T:Numeric'),
                                   (rgr, Type constructor
 `Main.NTCo:T:Numeric'),
                                   (rgs, Identifier `Main.D:Numeric')]
     In the instance declaration for `Numeric Int'
     In the Template Haskell quotation
       [d|
           instance Numeric Int where |]
     In the expression:
         [d|
             instance Numeric Int where |]
 Failed, modules loaded: none.
 }}}
 May be related to Ticket #4056 (?)

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4169>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to