TH vs. default function implementation: internal error
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 (closed) (?)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.12.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |