[Haskell-cafe] GADTs and Scrap your Boilerplate

Tom Hawkins tomahawkins at gmail.com
Sat May 15 21:34:02 EDT 2010


> 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 (==).


More information about the Haskell-Cafe mailing list