paperbot · PL 论文追踪

全部论文 待读 收藏

P2 What you needa know about Yoneda: profunctor optics and the Yoneda lemma (functional pearl)

关于 Yoneda 你需要知道的:profunctor optics 与 Yoneda 引理(函数式珍珠)
ICFP 2(ICFP)2018匹配度 1/10 · 该论文属于函数式编程与范畴论的形式化推导,讨论 Yoneda 引理和 profunctor optics,与用户关注的静态分析、ML/Agentic 程序分析、浮点程序分析、贝叶斯程序分析及 LLM 交叉方向均无直接关联。引用 18 inbox
Guillaume Boisseau, Jeremy Gibbons
crossref: 2026-09-10

AI 速览

一句话:用 Yoneda 引理从具体 getter/setter 表示推导 profunctor optics,阐明 lens/prism 的可组合表示。

本文是一篇 functional pearl,讨论 profunctor optics——一种可组合地表示双向数据访问器(如 lens 及其对偶 prism)的方式。Profunctor 表示利用高阶函数与高阶 kind 的类型构造器类,但其与常见的 getter/setter 具体表示之间的关系并不显然。作者从具体表示出发推导出 profunctor 表示,说明这一推导本质上是 Yoneda 引理的一个相当直接的运用。通过该推导,论文厘清了两种表示之间的对应关系,帮助读者理解 profunctor optics 的可组合性;反过来,也为理解范畴论中重要的 Yoneda 引理提供了直觉。

问题
Profunctor optics 与基于 getter/setter 的具体表示之间的关系不清晰,难以理解其可组合性与高阶类型编码。
方法
从具体表示出发,利用 Yoneda 引理推导出 profunctor 表示,从而显式建立两者的对应关系。
评估
通过理论推导并结合函数式编程中 lens/prism 等实例进行说明;作为 functional pearl,论文以讲解与洞察为主,不包含实验评估。
原文摘要(Abstract)

Profunctor optics are a neat and composable representation of bidirectional data accessors, including lenses, and their dual, prisms. The profunctor representation exploits higher-order functions and higher-kinded type constructor classes, but the relationship between this and the familiar representation in terms of "getter" and "setter" functions is not at all obvious. We derive the profunctor representation from the concrete representation, making the relationship clear. It turns out to be a fairly direct application of the Yoneda Lemma, arguably the most important result in category theory. We hope this derivation aids understanding of the profunctor representation. Conversely, it might also serve to provide some insight into the Yoneda Lemma.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot279,
  title = {What you needa know about Yoneda: profunctor optics and the Yoneda lemma (functional pearl)},
  author = {Guillaume Boisseau and Jeremy Gibbons},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {2},
  number = {ICFP},
  year = {2018},
  doi = {10.1145/3236779}
}