#2118: deriving for GRose
----------------------------------------------------+-----------------------
    Reporter:  alexey                               |        Owner:         
        Type:  bug                                  |       Status:  new    
    Priority:  normal                               |    Milestone:         
   Component:  Compiler                             |      Version:  6.8.2  
    Severity:  normal                               |   Resolution:         
    Keywords:  type classes, undecidable instances  |     Testcase:         
Architecture:  x86                                  |           Os:  MacOS X
----------------------------------------------------+-----------------------
Comment (by fons):

 Quoting the ghc 6.8.2 manual [1]

 ''
 "The rule is this: each constraint in the inferred instance context must
 consist only of type variables, with no repetitions. This rule is applied
 regardless of flags. If you want a more exotic context, you can write it
 yourself, using the standalone deriving mechanism."''

 And indeed, using the standalone deriving mechanism (flag
 -XStandaloneDeriving) we can create a Show instance of GRose:


 {{{
 {-# LANGUAGE StandaloneDeriving #-}

 data GRose ff a = GRose a (ff (GRose ff a))

 deriving instance (Show a, Show (ff (GRose ff a))) => Show (GRose ff a)
 }}}






 [1] http://www.haskell.org/ghc/docs/6.8.2/html/users_guide/deriving.html

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2118#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to