Authors
José Pedro Magalhães, Atze Dijkstra, Johan Jeuring, Andres Löh
Publication date
2010/11/17
Journal
ACM Sigplan Notices
Volume
45
Issue
11
Pages
37-48
Publisher
ACM
Description
Haskell's deriving mechanism supports the automatic generation of instances for a number of functions. The Haskell 98 Report only specifies how to generate instances for the Eq, Ord, Enum, Bounded, Show, and Read classes. The description of how to generate instances is largely informal. The generation of instances imposes restrictions on the shape of datatypes, depending on the particular class to derive. As a consequence, the portability of instances across different compilers is not guaranteed.
We propose a new approach to Haskell's deriving mechanism, which allows users to specify how to derive arbitrary class instances using standard datatype-generic programming techniques. Generic functions, including the methods from six standard Haskell 98 derivable classes, can be specified entirely within Haskell 98 plus multi-parameter type classes, making them lightweight and portable. We can also express …
Total citations
201120122013201420152016201720182019202020212022202320242139911681571110862
Scholar articles
JP Magalhães, A Dijkstra, J Jeuring, A Löh - ACM Sigplan Notices, 2010