
2011/8/4 José Pedro Magalhães
Here you seem to be using newtype deriving in particular, which behaves differently from standard deriving. Compiling with -ddump-deriv will show you the instances GHC is generating, which can help in debugging.
Aah - this is very useful, thanks!
Note however that deriving instances for GADTs is not trivial, in general. In particular, you should not assume that GHC knows that `s` can only be instantiated with `Buy` and `Sell` since (because we lack a proper kind system) nothing prevents you from later using, say, `Order Int Limit` somewhere.
Aah - this is something like what I suspected (The type signature for OrderListLevel doesn't preclude eg OrderListLevel Int which would need an instance of (Eq|Show) for Order Int Limit, which does not exist.
I describe the issue in more detail in the paper:
José Pedro Magalhães and Johan Jeuring. Generic Programming for Indexed Datatypes. Color pdf: http://dreixel.net/research/pdf/gpid.pdf Greyscale pdf: http://dreixel.net/research/pdf/gpid_nocolor.pdf
Oh, brilliant, thank you! I'll take a look now. Thanks, Tim