[Haskell] GADTs are not nice to me ;-)
Wolfgang Jeltsch
wolfgang at jeltsch.net
Mon Jul 3 10:16:06 EDT 2006
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
More information about the Haskell
mailing list