A Formal Comparison of Approaches to Datatype-Generic Programming
Datatype-generic programming increases program abstraction and reuse by making functions operate uniformly across different types. Many approaches to generic programming have been proposed over the years, most of them for Haskell, but recently also for dependently typed languages such as Agda. Diffe...
Main Authors: | , |
---|---|
Format: | Article |
Language: | English |
Published: |
Open Publishing Association
2012-02-01
|
Series: | Electronic Proceedings in Theoretical Computer Science |
Online Access: | http://arxiv.org/pdf/1202.2920v1 |
id |
doaj-f5b42d75cfd74712bc45e07a8cce759f |
---|---|
record_format |
Article |
spelling |
doaj-f5b42d75cfd74712bc45e07a8cce759f2020-11-24T22:49:01ZengOpen Publishing AssociationElectronic Proceedings in Theoretical Computer Science2075-21802012-02-0176Proc. MSFP 2012506710.4204/EPTCS.76.6A Formal Comparison of Approaches to Datatype-Generic ProgrammingJosé Pedro MagalhãesAndres LöhDatatype-generic programming increases program abstraction and reuse by making functions operate uniformly across different types. Many approaches to generic programming have been proposed over the years, most of them for Haskell, but recently also for dependently typed languages such as Agda. Different approaches vary in expressiveness, ease of use, and implementation techniques. Some work has been done in comparing the different approaches informally. However, to our knowledge there have been no attempts to formally prove relations between different approaches. We thus present a formal comparison of generic programming libraries. We show how to formalise different approaches in Agda, including a coinductive representation, and then establish theorems that relate the approaches to each other. We provide constructive proofs of inclusion of one approach in another that can be used to convert between approaches, helping to reduce code duplication across different libraries. Our formalisation also helps in providing a clear picture of the potential of each approach, especially in relating different generic views and their expressiveness.http://arxiv.org/pdf/1202.2920v1 |
collection |
DOAJ |
language |
English |
format |
Article |
sources |
DOAJ |
author |
José Pedro Magalhães Andres Löh |
spellingShingle |
José Pedro Magalhães Andres Löh A Formal Comparison of Approaches to Datatype-Generic Programming Electronic Proceedings in Theoretical Computer Science |
author_facet |
José Pedro Magalhães Andres Löh |
author_sort |
José Pedro Magalhães |
title |
A Formal Comparison of Approaches to Datatype-Generic Programming |
title_short |
A Formal Comparison of Approaches to Datatype-Generic Programming |
title_full |
A Formal Comparison of Approaches to Datatype-Generic Programming |
title_fullStr |
A Formal Comparison of Approaches to Datatype-Generic Programming |
title_full_unstemmed |
A Formal Comparison of Approaches to Datatype-Generic Programming |
title_sort |
formal comparison of approaches to datatype-generic programming |
publisher |
Open Publishing Association |
series |
Electronic Proceedings in Theoretical Computer Science |
issn |
2075-2180 |
publishDate |
2012-02-01 |
description |
Datatype-generic programming increases program abstraction and reuse by making functions operate uniformly across different types. Many approaches to generic programming have been proposed over the years, most of them for Haskell, but recently also for dependently typed languages such as Agda. Different approaches vary in expressiveness, ease of use, and implementation techniques. Some work has been done in comparing the different approaches informally. However, to our knowledge there have been no attempts to formally prove relations between different approaches. We thus present a formal comparison of generic programming libraries. We show how to formalise different approaches in Agda, including a coinductive representation, and then establish theorems that relate the approaches to each other. We provide constructive proofs of inclusion of one approach in another that can be used to convert between approaches, helping to reduce code duplication across different libraries. Our formalisation also helps in providing a clear picture of the potential of each approach, especially in relating different generic views and their expressiveness. |
url |
http://arxiv.org/pdf/1202.2920v1 |
work_keys_str_mv |
AT josepedromagalhaes aformalcomparisonofapproachestodatatypegenericprogramming AT andresloh aformalcomparisonofapproachestodatatypegenericprogramming AT josepedromagalhaes formalcomparisonofapproachestodatatypegenericprogramming AT andresloh formalcomparisonofapproachestodatatypegenericprogramming |
_version_ |
1725677535739510784 |