首页> 外文会议>Annual ACM SIGPLAN-SIGACT symposium on principles of programming languages >Copatterns: Programming Infinite Structures by Observations
【24h】

Copatterns: Programming Infinite Structures by Observations

机译:协同模式:通过观察编程无限结构

获取原文

摘要

Inductive datatypes provide mechanisms to define finite data such as finite lists and trees via constructors and allow programmers to analyze and manipulate finite data via pattern matching. In this paper, we develop a dual approach for working with infinite data structures such as streams. Infinite data inhabits coinductive datatypes which denote greatest fixpoints. Unlike finite data which is defined by constructors we define infinite data by observations. Dual to pattern matching, a tool for analyzing finite data, we develop the concept of copattern matching, which allows us to synthesize infinite data. This leads to a symmetric language design where pattern matching on finite and infinite data can be mixed. We present a core language for programming with infinite structures by observations together with its operational semantics based on (co)pattern matching and describe coverage of copatterns. Our language naturally supports both call-by-name and call-by-value interpretations and can be seamlessly integrated into existing languages like Haskell and ML. We prove type soundness for our language and sketch how copatterns open new directions for solving problems in the interaction of coinductive and dependent types.
机译:归纳数据类型提供了通过构造函数定义有限数据(例如有限列表和树)的机制,并允许程序员通过模式匹配来分析和操纵有限数据。在本文中,我们开发了一种用于处理无限数据结构(例如流)的双重方法。无限数据存在于共生数据类型中,这些数据类型代表最大的固定点。与构造函数定义的有限数据不同,我们通过观察来定义无限数据。对模式匹配(一种用于分析有限数据的工具)双重使用,我们开发了共模式匹配的概念,该概念使我们可以合成无限数据。这导致了一种对称语言设计,其中可以混合使用有限和无限数据上的模式匹配。我们通过观察以及基于(共)模式匹配的操作语义,提供了一种用于无限结构编程的核心语言,并描述了共模式的覆盖范围。我们的语言自然支持按名称进行呼叫和按值进行呼叫的解释,并且可以无缝集成到Haskell和ML等现有语言中。我们证明了我们语言的类型正确性,并勾勒了协同模式如何为共形和从属类型的交互问题解决提供新的方向。

著录项

相似文献

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

客服邮箱:kefu@zhangqiaokeyan.com

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

  • 服务号