I\'ve come across references to Haskell\'s Data.Typeable
, but it\'s not clear to me why I would want to use it in my code.
What problem does it solve, and h
The Data.Typeable class is used primarily for generic programming in the Scrap Your Boilerplate (SYB) style. See also Data.Data
The idea is that SYB defines a collection combinators for performing operations such as printing, counting, searching, substiting, etc in a uniform manner over a variety of user-created types. The Typeable
typeclass provides the necessary plumbing.
In modern GHC, you can just say deriving Data.Typeable
when defining your own type in order to provide it with the necessary instances.