【24h】

Hierarchy in Generic Programming Libraries

机译:泛型编程库中的层次结构

获取原文

摘要

Generic programming (GP) is a form of abstraction in programming languages that serves to reduce code duplication by exploiting the regular structure of algebraic datatypes. Several different approaches to GP in Haskell have surfaced, giving rise to the problem of code duplication across GP libraries. Given the original goals of GP, this is a rather unfortunate turn of events. Fortunately, we can convert between the different representations of each approach, which allows us to "borrow" generic functions from different approaches, avoiding the need to reimplement every generic function in every single GP library. In previous work we have shown how existing GP libraries relate to each other. In this paper we go one step further and advocate "hierarchical GP": through proper design of different GP approaches, each library can fit neatly in a hierarchy, greatly minimizing the amount of supporting infrastructure necessary for each approach, and allowing each library to be specific and concise, while eliminating code duplication overall. We introduce a new library for GP in Haskell intended to sit at the top of the "GP hierarchy". This library contains a lot of structural information, and is not intended to be used directly. Instead, it is a good starting point for generating generic representations for other libraries. This approach is also suitable for being the only library with native compiler support; all other approaches can be obtained from this one by simple conversion of representations in plain Haskell code.
机译:通用编程(GP)是编程语言中的抽象形式,用于通过利用代数数据类型的常规结构来降低代码复制。 Haskell的几种不同的GP方法已经浮出水面,引起了GP库跨越GP库的代码重复问题。鉴于GP的原始目标,这是一个相当不幸的事件转向。幸运的是,我们可以在每个方法的不同表现之间转换,这使我们能够从不同方法“借用”通用功能,避免需要在每个单个GP库中重新实现每个通用功能。在以前的工作中,我们已经显示了现有的GP库如何相互关联。在本文中,我们进一步走了一步并倡导“分层GP”:通过适当的不同GP方法设计,每个库可以整齐地融合在层次结构中,大大最小化了每种方法所需的支持基础设施的量,并允许每个图书馆具体而简洁,同时消除总体代码重复。我们在Haskell介绍了一个新的GP图书馆,旨在坐在“GP层次结构”的顶部。此库包含大量的结构信息,并不意图直接使用。相反,它是为其他库生成通用表示的良好起点。这种方法也适用于唯一具有本机编译支持的库;通过简单地转换普通HASKELL代码中的表示,可以从此获得所有其他方法。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号