论文标题

profunctor光学,一个分类更新

Profunctor Optics, a Categorical Update

论文作者

Clarke, Bryce, Elkins, Derek, Gibbons, Jeremy, Loregian, Fosco, Milewski, Bartosz, Pillmore, Emily, Román, Mario

论文摘要

光学是双向数据登录器,可捕获数据转换模式,例如访问子字段或在容器上迭代。分配器光学是支持模块化的表示的特定选择,这意味着我们可以通过组合简单的结构来构造复杂结构的访问者。 Profunctor Optics先前仅在未添加和非混合设置中进行了研究,其中两个访问方向都在同一类别中进行建模。但是,功能编程语言可以说是通过丰富的类别更好地描述的。而且我们发现文献中的某些结构实际上是混合的光学器件,访问说明以不同的类别建模。我们的工作概括了Pastro和Street在Tambara理论上的经典结果,并使用它来描述富含V型的分配器光学器件,并赋予它们使用V类别结构。我们提供一些原始的光学和衍生家族,包括用于遍历的基础。最后,我们讨论了Haskell实施。

Optics are bidirectional data accessors that capture data transformation patterns such as accessing subfields or iterating over containers. Profunctor optics are a particular choice of representation supporting modularity, meaning that we can construct accessors for complex structures by combining simpler ones. Profunctor optics have previously been studied only in an unenriched and non-mixed setting, in which both directions of access are modelled in the same category. However, functional programming languages are arguably better described by enriched categories; and we have found that some structures in the literature are actually mixed optics, with access directions modelled in different categories. Our work generalizes a classic result by Pastro and Street on Tambara theory and uses it to describe mixed V-enriched profunctor optics and to endow them with V-category structure. We provide some original families of optics and derivations, including an elementary one for traversals. Finally, we discuss a Haskell implementation.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源