Arity-Generic Datatype-Generic Programming

被引:9
|
作者
Weirich, Stephanie [1 ]
Casinghino, Chris [1 ]
机构
[1] Univ Penn, Philadelphia, PA 19104 USA
关键词
Dependent types; Arity-generic programming; Agda; Generic Haskell; HASKELL;
D O I
10.1145/1707790.1707799
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Some programs are doubly-generic. For example, map is datatype-generic in that many different data structures support a mapping operation. A generic programming language like Generic Haskell can use a single definition to generate map for each type. However, map is also arity-generic because it belongs to a family of related operations that differ in the number of arguments. For lists, this family includes repeat, map, zipWith, zipWith3, zipWith4, etc. With dependent types or clever programming, one can unify all of these functions together in a single definition. However, no one has explored the combination of these two forms of genericity. These two axes are not orthogonal because the idea of arity appears in Generic Haskell: datatype-generic versions of repeat, map and zipWith have different arities of kind-indexed types. In this paper, we define arity-generic datatype-generic programs by building a framework for Generic Haskell-style generic programming in the dependently-typed programming language Agda 2.
引用
收藏
页码:15 / 26
页数:12
相关论文
共 50 条
  • [1] Datatype-generic programming
    Gibbons, Jeremy
    [J]. DATATYPE-GENERIC PROGRAMMING, 2007, 4719 : 1 - +
  • [2] Datatype-generic reasoning
    Backhouse, Roland
    [J]. LOGICAL APPROACHES TO COMPUTATIONAL BARRIERS, PROCEEDINGS, 2006, 3988 : 21 - 34
  • [3] Datatype-Generic Programming Meets Elaborator Reflection
    Ko, Hsiang-Shang
    Chen, Liang-Ting
    Lin, Tzu-Chi
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2022, 6 (ICFP):
  • [4] A Formal Comparison of Approaches to Datatype-Generic Programming
    Magalhaes, Jose Pedro
    Loeh, Andres
    [J]. ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2012, (76): : 50 - 67
  • [5] Datatype-Generic Termination Proofs
    Roland Backhouse
    Henk Doornbos
    [J]. Theory of Computing Systems, 2008, 43 : 362 - 393
  • [6] Datatype-Generic Termination Proofs
    Backhouse, Roland
    Doornbos, Henk
    [J]. THEORY OF COMPUTING SYSTEMS, 2008, 43 (3-4) : 362 - 393
  • [7] A lightweight approach to datatype-generic rewriting
    Van Noort, Thomas
    Yakushev, Alexey Rodriguez
    Holdermans, Stefan
    Jeuring, Johan
    Heeren, Bastiaan
    Magalhaes, Jose Pedro
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2010, 20 : 375 - 413
  • [8] A Lightweight Approach to Datatype-Generic Rewriting
    van Noort, Thomas
    Rodriguez, Alexey
    Holdermans, Stefan
    Jeuring, Johan
    Heeren, Bastiaan
    [J]. WGP'08: PROCEEDINGS OF THE 2008 ACM SIGPLAN WORKSHOP ON GENERIC PROGRAMMING, 2008, : 13 - 24
  • [9] System F-omega with Equirecursive Types for Datatype-Generic Programming
    Cai, Yufei
    Giarrusso, Paolo G.
    Ostermann, Klaus
    [J]. ACM SIGPLAN NOTICES, 2016, 51 (01) : 30 - 43
  • [10] Constructing Datatype-Generic Fully Polynomial-Time Approximation Schemes Using Generalised Thinning
    Mu, Shin-Cheng
    Lyu, Yu-Han
    Morihata, Akimasa
    [J]. WGP 2010: PROCEEDINGS OF THE 2010 ACM SIGPLAN WORKSHOP ON GENERIC PROGRAMMING, 2010, : 97 - 108