instance decls via TH: dropped methods and stack overflows
{-# LANGUAGE TemplateHaskell #-}
class C a where
c :: a
$([d| instance C Int where c = 0 |] )
data D = D
$([d| instance C D where c = D |] )
$([d| instance Show D where show _ = "D" |] )
Loading this into GHCI:
/tmp/Foo.hs:6:3:
Warning: No explicit method nor default method for `c'
In the instance declaration for `C Int'
/tmp/Foo.hs:10:3:
Warning: No explicit method nor default method for `c'
In the instance declaration for `C D'
Ok, modules loaded: Main.
ghci> c :: Int
*** Exception: /tmp/Foo.hs:6:3-35: No instance nor default method for class operation Main.c
ghci> c :: D
*** Exception: stack overflow
ghci> show D
"*** Exception: stack overflow
ghci>
I also tried putting C and/or D into separate modules, to no effect.
Trac metadata
Trac field | Value |
---|---|
Version | 7.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |