Reputation: 241
I'm writing an open source patch to use a font library, or rather the haskell bindings to a font library in C (FTGL). I'm pointing to the Font type in one of the data structures, which is defined as follows:
type Font = Ptr Font_Opaque
data Font_Opaque
Unfortunately, to fit into the data structure of the library I'm patching, this type needs to be an instance of Data. Ptr already is, but Font_Opaque obviously isn't, so the compiler complains.
As it's an opaque type I'm not sure how to proceed ... how to implement Data Font_Opaque in a more or less sensible way? Is there a sensible way?
Upvotes: 16
Views: 923
Reputation: 241
As the comment by András Kovács suggests, using the StandaloneDeriving language extension
{-# LANGUAGE StandaloneDeriving -#}
and then:
deriving instance Data Font_Opaque
did the trick, at least where the compiler is concerned. I'll report back if this affects the program in any way. Thanks!
Upvotes: 5