arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1406.2061cs.PL
收藏

Koka:使用行多态效应类型编程

Koka: Programming with Row Polymorphic Effect Types

Daan Leijen

摘要:

我们提出了一个编程模型,其中的影响被视为在一个纪律的方式,并在一个函数的潜在副作用是显而易见的,在其类型签名。表达式的类型和效果也可以自动推断,我们描述了一个多态类型推断系统的基础上Hindley-Milner风格推理。一个新的功能是,我们支持多态性的影响,通过行多态性使用重复的标签。此外,我们表明,我们的效果不只是语法标签,但有一个深刻的语义连接到程序。例如,如果一个表达式可以在没有exn效应的情况下进行类型化,那么它永远不会抛出未处理的异常。与Haskell的runST类似,我们展示了如何安全地封装有状态操作。通过状态效应,我们还可以安全地将状态与let多态性结合起来,而不需要强制类型变量或语法值限制。最后,我们的系统完全用一种名为Koka的新语言实现,并已成功用于各种中小型示例程序,从Markdown处理器到分层聊天应用程序。您可以在www.rise4fun.com/koka/tutorial上试用Koka live。

英文摘要:

We propose a programming model where effects are treated in a disciplined way, and where the potential side-effects of a function are apparent in its type signature. The type and effect of expressions can also be inferred automatically, and we describe a polymorphic type inference system based on Hindley-Milner style inference. A novel feature is that we support polymorphic effects through row-polymorphism using duplicate labels. Moreover, we show that our effects are not just syntactic labels but have a deep semantic connection to the program. For example, if an expression can be typed without an exn effect, then it will never throw an unhandled exception. Similar to Haskell's `runST` we show how we can safely encapsulate stateful operations. Through the state effect, we can also safely combine state with let-polymorphism without needing either imperative type variables or a syntactic value restriction. Finally, our system is implemented fully in a new language called Koka and has been used successfully on various small to medium-sized sample programs ranging from a Markdown processor to a tier-splitted chat application. You can try out Koka live at www.rise4fun.com/koka/tutorial.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑