how to make something Typeable, for Data.Dynamic?

Hi, Can someone show me a code snippet that would make a simple record type Typeable so I can wrap one in a Data.Dynamic? I'm looking at the haddock docs and I don't see how to do it. I know to define "typeOf :: MyRecord -> TypeRep". But how to make a TypeRep? thanks, Rob

You need the language extension DeriveDataTypeable, and then you just add deriving (Typeable) to the end of your data declaration. Cheers, Edward Excerpts from Rob Nikander's message of Mon Apr 04 17:16:57 -0400 2011:
Hi,
Can someone show me a code snippet that would make a simple record type Typeable so I can wrap one in a Data.Dynamic? I'm looking at the haddock docs and I don't see how to do it. I know to define "typeOf :: MyRecord -> TypeRep". But how to make a TypeRep?
thanks, Rob
participants (2)
-
Edward Z. Yang
-
Rob Nikander