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

OCaml中的泛型编程

Generic Programming in OCaml

Florent Balestrieri, Michel Mauny

摘要:

我们提出了一个通用编程在OCaml库,适应一些技术借鉴其他函数式语言。该库利用了OCaml最近增加的三个功能:通用抽象数据库对于反映类型是必不可少的,可扩展的变体允许这种反映对新的添加开放,扩展点提供语法糖并生成简化库使用的样板代码。该库的构建块可用于通过视图的概念支持许多泛型编程方法。泛型遍历是在库的顶部实现的,并提供强大的组合子来编写复杂树类型上递归函数的简洁定义。我们的案例研究是一个尊重类型抽象的类型安全函数。

英文摘要:

We present a library for generic programming in OCaml, adapting some techniques borrowed from other functional languages. The library makes use of three recent additions to OCaml: generalised abstract datatypes are essential to reflect types, extensible variants allow this reflection to be open for new additions, and extension points provide syntactic sugar and generate boiler plate code that simplify the use of the library. The building blocks of the library can be used to support many approaches to generic programming through the concept of view. Generic traversals are implemented on top of the library and provide powerful combinators to write concise definitions of recursive functions over complex tree types. Our case study is a type-safe deserialisation function that respects type abstraction.

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

↑