[GHC] #5566: instance decls via TH: dropped methods and stack overflows
GHC
cvs-ghc at haskell.org
Tue Oct 18 17:53:09 CEST 2011
#5566: instance decls via TH: dropped methods and stack overflows
---------------------------------+------------------------------------------
Reporter: FSalad | Owner:
Type: bug | Status: new
Priority: normal | Component: Template Haskell
Version: 7.2.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
{{{
{-# 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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5566>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list