arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2103.06195cs.PL
收藏

关于对称Monoidal范畴的线性函数求值

Evaluating Linear Functions to Symmetric Monoidal Categories

Jean-Philippe Bernardy, Arnaud Spiwack

摘要:

许多领域特定的语言,如电路或数据科学工作流,最好用电线连接的方框图来表示。不幸的是,函数式语言传统上不适合嵌入这类语言。Arrow抽象是一种近似,但我们认为它没有捕获正确的属性。一个忠实的抽象是对称Monoidal范畴(SMCs),但到目前为止,它还不方便使用。我们将展示Haskell中线性类型的出现如何让我们弥合这一差距。我们提供了一个库,它可以让我们在SMC中使用线性函数而不是SMC组合器进行编程。这大大降低了EDSL的语法开销,使其与一元DSL不相上下。我们的库的一个显著特点是,与以前已知的类别方法相反,它不使用任何元编程。

英文摘要:

A number of domain specific languages, such as circuits or data-science workflows, are best expressed as diagrams of boxes connected by wires. Unfortunately, functional languages have traditionally been ill-equipped to embed this sort of languages. The Arrow abstraction is an approximation, but we argue that it does not capture the right properties. A faithful abstraction is Symmetric Monoidal Categories (SMCs), but,so far,it hasn't been convenient to use. We show how the advent of linear typing in Haskell lets us bridge this gap. We provide a library which lets us program in SMCs with linear functions instead of SMC combinators. This considerably lowers the syntactic overhead of the EDSL to be on par with that of monadic DSLs. A remarkable feature of our library is that, contrary to previously known methods for categories, it does not use any metaprogramming.

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

↑