On Sun, May 16, 2010 at 2:34 AM, Tom Hawkins
I got the GADT
data DataBox where DataBox :: (Show d, Eq d, Data d) => d -> DataBox
[snip]
but I can't figure out how to implement gunfold for DataBox.
The error message is
Text/XML/Generic.hs:274:23: Ambiguous type variable `b' in the constraints:
I had a similar difficultly in Atom making a GADT a member of Eq. At one point I had my head wrapped around the reason for the problem, but now it escapes me. However, I remember the solution: I created a function to convert the GADT into another, unGADT type, which was then used to compute (==). _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Have you tried using StandaloneDeriving (and DeriveDataTypeable)? According to http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/deriving.html#stand-... you can't derive instances for GADTs normally but a standalone derivation will at least attempt to make an instance as if it was an ordinary data type.