4

[1103.2841] Functor is to Lens as Applicative is to Biplate: Introducing Multipl...

 3 years ago
source link: https://arxiv.org/abs/1103.2841
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Submitted on 15 Mar 2011 (v1), last revised 11 Jul 2011 (this version, v2)]

Functor is to Lens as Applicative is to Biplate: Introducing Multiplate

Download PDF

This paper gives two new categorical characterisations of lenses: one as a coalgebra of the store comonad, and the other as a monoidal natural transformation on a category of a certain class of coalgebras. The store comonad of the first characterisation can be generalized to a Cartesian store comonad, and the coalgebras of this Cartesian store comonad turn out to be exactly the Biplates of the Uniplate generic programming library. On the other hand, the monoidal natural transformations on functors can be generalized to work on a category of more specific coalgebras. This generalization turns out to be the type of compos from the Compos generic programming library. A theorem, originally conjectured by van Laarhoven, proves that these two generalizations are isomorphic, thus the core data types of the Uniplate and Compos libraries supporting generic program on single recursive types are the same. Both the Uniplate and Compos libraries generalize this core functionality to support mutually recursive types in different ways. This paper proposes a third extension to support mutually recursive data types that is as powerful as Compos and as easy to use as Uniplate. This proposal, called Multiplate, only requires rank 3 polymorphism in addition to the normal type class mechanism of Haskell.

Comments: To appear in ACM SIGPLAN 7th Workshop on Generic Programming, Tokyo, 18th September 2011 Subjects: Programming Languages (cs.PL) Cite as: arXiv:1103.2841 [cs.PL]   (or arXiv:1103.2841v2 [cs.PL] for this version)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK