Affiliation:
1. Vector Fabrics B.V., Eindhoven, Netherlands
2. Utrecht University, Utrecht, Netherlands
Abstract
Many datatype-generic functions need access to the recursive positions in the structure of the datatype, and therefore adopt a fixed point view on datatypes. Examples include variants of fold that traverse the data following the recursive structure, or the Zipper data structure that enables navigation along the recursive positions. However, Hindley-Milner-inspired type systems with algebraic datatypes make it difficult to express fixed points for anything but regular datatypes. Many real-life examples such as abstract syntax trees are in fact systems of mutually recursive datatypes and therefore excluded. Using Haskell's GADTs and type families, we describe a technique that allows a fixed-point view for systems of mutually recursive datatypes. We demonstrate that our approach is widely applicable by giving several examples of generic functions for this view, most prominently the Zipper.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
9 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Algorithmics;IFIP Advances in Information and Communication Technology;2021
2. Unraveling Recursion: Compiling an IR with Recursion to System F;Lecture Notes in Computer Science;2019
3. Packrats parse in packs;ACM SIGPLAN Notices;2017-10-31
4. Packrats parse in packs;Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell;2017-09-07
5. The HERMIT in the machine;ACM SIGPLAN Notices;2013-01-17