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

(深)GADT有多功能?

How Functorial Are (Deep) GADTs?

Patricia Johann, Pierre Cagne

摘要:

众所周知,GADT不接受ADT和嵌套类型所支持的那种标准映射函数。此外,标准map函数不足以将其数据更改参数函数分布在深层GADT元素中的所有结构上,即使只是深层ADT或嵌套类型。本文开发了一种算法,用于检测哪些函数可以映射到类型为(深度)GADT的数据上。该算法将其类型是深GADT D的实例的项t和要映射到t上的函数f作为输入。它检测t的最小可能形状作为D的元素,并返回f必须满足的最小约束集,以在t上映射。该算法的关键是它能够将t的基本结构分离为D的元素-即,t的一部分,这部分对于它具有D的元素的形状是必不可少的--从它作为D的元素的附带结构来看--即,t的一部分,就是这个形状的位置上的数据。该算法确保f上的约束仅来自t的基本结构。这项工作是一个正在进行的努力,以定义初始代数语义GADT,适当地概括了通常的语义ADT和嵌套类型的高阶endofunctors的至少不动点。

英文摘要:

It is well-known that GADTs do not admit standard map functions of the kind supported by ADTs and nested types. In addition, standard map functions are insufficient to distribute their data-changing argument functions over all of the structure present in elements of deep GADTs, even just deep ADTs or nested types. This paper develops an algorithm for detecting exactly which functions are mappable over data whose types are (deep) GADTs. The algorithm takes as input a term t whose type is an instance of a deep GADT D and a function f to be mapped over t. It detects a minimal possible shape of t as an element of D, and returns a minimal set of constraints f must satisfy to be mappable over t. The crux of the algorithm is its ability to separate t's essential structure as an element of D -- i.e., the part of t that is essential for it to have the shape of an element of D -- from its incidental structure as an element of D -- i.e., the part of t that is simply data in the positions of this shape. The algorithm ensures that the constraints on f come only from t's essential structure. This work is part of an ongoing effort to define initial algebra semantics for GADTs that properly generalizes the usual semantics for ADTs and nested types as least fixpoints of higher-order endofunctors.

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

↑