Ticket #5566 (closed bug: fixed)
instance decls via TH: dropped methods and stack overflows
Description
{-# 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.
Change History
Note: See
TracTickets for help on using
tickets.
