[GHC] #5007: "deriving" seems to ignore class context for a type family
GHC
cvs-ghc at haskell.org
Wed Mar 9 08:50:57 CET 2011
#5007: "deriving" seems to ignore class context for a type family
---------------------------------+------------------------------------------
Reporter: jkff | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler (Type checker)
Version: 7.0.2 | Keywords: type families, datatype contexts, type classes, deriving
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: GHC rejects valid program
---------------------------------+------------------------------------------
{{{
class Foo a where
data Bar a :: *
class (Show (Bar a)) => Qux a
data (Qux a) => Xyzzy a = Xyzzy (Bar a) deriving Show
}}}
Here I get the following error:
{{{
No instance for (Show (Bar a))
arising from the 'deriving' clause of a data type declaration
Possible fix:
add an instance declaration for (Show (Bar a))
or use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
When deriving the instance for (Show (Xyzzy a))
}}}
Curiously, I get the same error even if I add ", Show (Bar a)" to the
context of "Xyzzy".
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5007>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list