[Haskell-cafe] Class deriving in GHC 6.8

Emil Axelsson emax at cs.chalmers.se
Thu Dec 20 05:54:20 EST 2007


After looking more closely at user's manual, I just found that the following works:

> {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-}
> data Foo   = Foo deriving Show
> data Bar c = Bar (c Foo)               
> 
> deriving instance Show (c Foo) => Show (Bar c)

/ Emil



On 2007-12-20 11:18, Emil Axelsson wrote:
> Hello all!
> 
> How come in GHC 6.6 I could to write
> 
>> {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-}
>> data Foo   = Foo         deriving Show
>> data Bar c = Bar (c Foo) deriving Show
> 
> but in GHC 6.8.2 I get the error
> 
>>     No instance for (Show (c Foo))
>>       arising from the 'deriving' clause of a data type declaration
>>                    at Ert.hs:3:0-37
>>     Possible fix: add an instance declaration for (Show (c Foo))
>>     When deriving the instance for (Show (Bar c))
> 
> 
> 
> Thanks,
> 
> / Emil
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list