A well-known representation of monoids and its application to the function 'vector reverse'

JOURNAL OF FUNCTIONAL PROGRAMMING(2022)

引用 1|浏览39
暂无评分
摘要
Vectors-or length-indexed lists-are classic example of a dependent type. Yet, most tutorials stay clear of any function on vectors whose definition requires non-trivial equalities between natural numbers to type check. This pearl shows how to write functions, such as vector reverse, that rely on monoidal equalities to be type correct without having to write any additional proofs. These techniques can be applied to many other functions over types indexed by a monoid, written using an accumulating parameter, and even be used to decide arbitrary equalities over monoids 'for free.'
更多
查看译文
AI 理解论文
溯源树
样例
生成溯源树,研究论文发展脉络
Chat Paper
正在生成论文摘要