...
首页> 外文期刊>ACM SIGPLAN Notices: A Monthly Publication of the Special Interest Group on Programming Languages >Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism
【24h】

Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism

机译:Boxes Go Bananas:使用参数多态性编码高阶抽象语法

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

获取外文期刊封面封底 >>

       

摘要

Higher-order abstract syntax is a simple technique for implementing languages with functional programming. Object variables and binders are implemented by variables and binders in the host language. By using this technique, one can avoid implementing common and tricky routines dealing with variables, such as capture-avoiding substitution. However, despite the advantages this technique provides, it is not commonly used because it is difficult to write sound elimination forms (such as folds or catamorphisms) for higher-order abstract syntax. To fold over such as datatype, one must either simultaneously define an inverse operation (which may not exist) or show that all functions embedded in the datatype are parametric. In this paper, we show how first-class polymorphism can be used to guarantee the parametricity of functions embedded in higher-order abstract syntax. With this restriction, we implement a library of iteration operators over data-structures containing functionals. From this implementation, we derive "fusion laws" that functional programmers may use to reason about the iteration operator. Finally, we show how this use of parametric polymorphism corresponds to the Schurmann, Despeyroux and Pfenning method of enforcing parametricity through modal types. We do so by using this library to give a sound and complete encoding of their calculus into System F_ω. This encoding can serve as a starting point for reasoning about higher-order structures in polymorphic languages.
机译:高阶抽象语法是一种通过函数式编程实现语言的简单技术。对象变量和联编程序由宿主语言中的变量和联编程序实现。通过使用这种技术,可以避免实现处理变量的常见且棘手的例程,例如避免捕获的替换。但是,尽管此技术提供了优势,但由于很难为高阶抽象语法编写声音消除形式(例如折叠或同构词法),因此并不常用。要折叠这样的数据类型,必须要么同时定义一个逆运算(可能不存在),要么证明嵌入在数据类型中的所有函数都是参数化的。在本文中,我们展示了如何使用一流的多态性来保证嵌入到高阶抽象语法中的函数的参数性。有了这个限制,我们在包含函数的数据结构上实现了一个迭代运算符库。从此实现中,我们得出“融合定律”,函数程序员可以使用这些定律来推理迭代运算符。最后,我们说明如何使用参数多态性对应于通过模态类型强制参数化的Schurmann,Despeyroux和Pfenning方法。通过使用此库,可以对它们的演算进行完整的声音编码,并将其编码为SystemF_ω。这种编码可以作为推理多态语言中高阶结构的起点。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号