arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.03170cs.PL
收藏

typedKanren:Haskell 中具有穷尽匹配的静态类型关系编程

typedKanren: Statically Typed Relational Programming with Exhaustive Matching in Haskell

Nikolai Kudasov, Artem Starikov

AI总结:

本文提出在Haskell中静态类型嵌入带不等性约束的miniKanren关系编程,通过支持静态穷尽性检查的关系匹配扩展组合子库,并利用GHC.Generics与Template Haskell简化用户自定义类型的逻辑编程,最后以示例验证并比较性能。

摘要:

我们提出了在 Haskell 中关系编程(具体而言,是带有不等性约束的 miniKanren 方言)的一种静态类型嵌入。除了处理类型之外,我们的方言还通过一种支持静态穷尽性检查的关系匹配变体,扩展了标准关系组合子库。为了隐藏样板定义并支持使用用户自定义数据类型进行舒适的逻辑编程,我们使用了经由 GHC.Generics 的泛型编程以及经由 Template Haskell 的元编程。我们在若干示例上展示了我们的方言,并将其性能与其他一些已知的 miniKanren 实现进行了比较。

英文摘要:

We present a statically typed embedding of relational programming (specifically a dialect of miniKanren with disequality constraints) in Haskell. Apart from handling types, our dialect extends standard relational combinator repertoire with a variation of relational matching that supports static exhaustiveness checks. To hide the boilerplate definitions and support comfortable logic programming with user-defined data types we use generic programming via GHC.Generics as well as metaprogramming via Template Haskell. We demonstrate our dialect on several examples and compare its performance against some other known implementations of miniKanren.

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

↑