Research indexJournal article
RepLib
Weirich
ACM SIGPLAN Symposium/Workshop on Haskell17 Sep 2006
NobleIDark:/48914/w1/20260515/D709AA1FDOI10.1145/1159842.1159844
RepLib
Weirich · ACM SIGPLAN Symposium/Workshop on Haskell · 2006 · Subscription
NobleIDark:/48914/w1/20260515/D709AA1FDOI10.1145/1159842.1159844
The full text is at the publisher
You can read the abstract here, or open it at the publisher.
Abstract
Some type class instances can be automatically derived from the structure of types. As a result, the Haskell language includes the "deriving" mechanism to automatic generates such instances for a small number of built-in type classes. In this paper, we present RepLib, a GHC library that enables a similar mechanism for arbitrary type classes. Users of RepLib can define the relationship between the structure of a datatype and the associated instance declaration by a normal Haskell functions that pattern-matches a representation type. Furthermore, operations defined in this manner are extensible-instances for specific types not defined by type structure may also be incorporated. Finally, this library also supports the definition of operations defined by parameterized types.