首页> 外文期刊>Journal of Functional Programming >Scala for generic programmers Comparing Haskell and Scala support for generic programming
【24h】

Scala for generic programmers Comparing Haskell and Scala support for generic programming

机译:针对通用程序员的Scala比较Haskell和Scala对通用编程的支持

获取原文
获取原文并翻译 | 示例

摘要

Datatype-generic programming (DGP) involves parametrization of programs by the shape of data, in the form of type constructors such as 'list of. Most approaches to DGP are developed in pure functional programming languages such as Haskell. We argue that the functional object-oriented language Scala is in many ways a better choice. Not only does Scala provide equivalents of all the necessary functional programming features (such as parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). Common Haskell techniques for DGP can be conveniently replicated in Scala, whereas the extra expressivity provides some important additional benefits in terms of extensibility and reuse. We illustrate this by comparing two simple approaches in Haskell, pointing out their limitations and showing how equivalent approaches in Scala address some of these limitations. Finally, we present three case studies on how to implement in Scala real DGP approaches from the literature: Hinze's 'Generics for the Masses', Lammel and Peyton Jones's 'Scrap your Boilerplate with Class', and Gibbons's 'Origami Programming'.
机译:数据类型通用编程(DGP)涉及通过数据的形状,以类型构造函数(例如“列表”)的形式对程序进行参数化。 DGP的大多数方法都是用纯函数式编程语言(例如Haskell)开发的。我们认为功能性的面向对象语言Scala在许多方面都是更好的选择。 Scala不仅提供所有必需的功能编程功能(例如,参数多态性,高阶函数,更高种类的类型操作以及类型和构造函数类)的等效项,而且还提供了对象-的最有用的功能-面向语言(例如,子类型化,覆盖,传统的单继承和特征形式的多继承)。 DGP的常见Haskell技术可以在Scala中方便地复制,而额外的可表达性在可扩展性和重用性方面提供了一些重要的附加好处。我们通过比较Haskell中的两种简单方法,指出它们的局限性并展示Scala中的等效方法如何解决其中的一些局限性来说明这一点。最后,我们从文献中介绍了三个如何在Scala中实现实际DGP方法的案例研究:Hinze的“大众通用语言”,Lammel和Peyton Jones的“用类浪费您的样板”以及Gibbons的“折纸编程”。

著录项

  • 来源
    《Journal of Functional Programming》 |2010年第4期|p.303-352|共50页
  • 作者单位

    ROSAEC Center, Seoul National University, 599 Gwanak-ro, Gwanak-gu, Seoul 151-744, South Korea;

    rnOxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK;

  • 收录信息 美国《科学引文索引》(SCI);
  • 原文格式 PDF
  • 正文语种 eng
  • 中图分类
  • 关键词

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号