[Haskell] GADTs are not nice to me ;-)

Chris Kuklewicz haskell at list.mightyreason.com
Tue Jul 4 13:54:52 EDT 2006


Wolfgang Jeltsch wrote:
 > Am Montag, 3. Juli 2006 18:46 schrieb Simon Peyton-Jones:
 >> Thanks.  Can you confirm that it's fixed in 6.4.2?  And if so, can you
 >> record that too?  No point in us haring after fixed bugs!
 >>
 >> S
 >
 > As Chris Kuklewicz pointed out, this bug doesn't seem to be completely fixed
 > in 6.4.2.  Currently, I neither can confirm this nor can I disprove it since
 > at the moment there seem to be no Debian packages for 6.4.2 which I could
 > install and I don't have the time to install GHC from source.
 >
 > Best wishes,
 > Wolfgang

I am using ghc-6.4.2 from darwinports on OS X 10.4.7

Can I help confirm / test this with something test cases?

The older messages were:

 > Wolfgang Jeltsch wrote:
 >> Hello everybody,
 >>
 >> 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).  I don't really understand this 
since in my opinion it is clear that bool :: Bool and integer :: Integer and 
that therefore bool and integer are showable.  What's the problem with my code?
 >>
 >> Best wishes,
 >> Wolfgang
 >
 > 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.
 >
 > Changing the definition of Pair made it compile and run with ghc:
 >
 >> data Pair :: (* -> *) -> * where
 >>   Pair :: (Show b) => a b -> b -> Pair a



More information about the Haskell mailing list