#810: GHC complains about missing instance in conjunction with GADTs
-------------------------------------+--------------------------------------
    Reporter:  [EMAIL PROTECTED]  |        Owner:         
        Type:  bug                   |       Status:  new    
    Priority:  normal                |    Milestone:         
   Component:  Compiler              |      Version:  6.4.1  
    Severity:  normal                |     Keywords:         
          Os:  Linux                 |   Difficulty:  Unknown
Architecture:  x86                   |  
-------------------------------------+--------------------------------------
I wanted to do something like that:
 {{{
 data Pair :: (* -> *) -> * where
     Pair :: a b -> b -> Pair a

 data Sel :: * -> * where
     A :: Sel Bool
     B :: Sel Integer

 showSnd :: Pair Sel -> String
 showSnd (Pair A bool)    = show bool
 showSnd (Pair B integer) = show integer
 }}}
 However, GHC 6.4.1 with -fglasgow-exts complains in the second last and
 last
 line that there is no instance for (Show b).  But it is clear that bool ::
 Bool and integer :: Integer and that therefore bool and integer are
 showable.  In addition, Chris Kuklewicz said the following:
   I cut and pasted your code into ghci-6.4.2 with -fglasgow-exts and there
 was no
 error.  And I can (print (showSnd (Pair A True)) and (print (showSnd (Pair
 B
 8))) but when I try to compile it with ghc-6.4.2 it complains about the
 Show
 instance.  I find this deeply wierd, and it seems like a bug.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/810>
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