Dualizing Generalized Algebraic Data Types by Matrix Transposition
Dualizing Generalized Algebraic Data Types by Matrix Transposition
复制标题
通过矩阵转置对偶广义代数数据类型
DOI:
10.1007/978-3-319-89884-1_3
复制
发表时间:
2018
期刊:
影响因子:
--
通讯作者:
Julian Jabs
中科院分区:
文献类型:
--
作者:
Klaus Ostermann;Julian Jabs
We characterize the relation between generalized algebraic datatypes (GADTs) with pattern matching on their constructors one hand, and generalized algebraic co-datatypes (GAcoDTs) with copattern matching on their destructors on the other hand: GADTs can be converted mechanically to GAcoDTs by refunctionalization, GAcoDTs can be converted mechanically to GADTs by defunctionalization, and both defunctionalization and refunctionalization correspond to a transposition of the matrix in which the equations for each constructor/destructor pair of the (co-)datatype are organized. We have defined a calculus,, which unifies GADTs and GAcoDTs in such a way that GADTs and GAcoDTs are merely different ways to partition the program.We have formalized the type system and operational semantics ofin the Coq proof assistant and have mechanically verified the following results: (1) The type system ofis sound, (2) defunctionalization and refunctionalization can translate GADTs to GAcoDTs and back, (3) both transformations are type- and semantics-preserving and are inverses of each other, (4) (co-)datatypes can be represented by matrices in such a way the aforementioned transformations correspond to matrix transposition, (5) GADTs are extensible in an exactly dual way to GAcoDTs; we thereby clarify folklore knowledge about the “expression problem”.We believe that the identification of this relationship can guide future language design of “dual features” for data and codata.
登录
查看更多内容
DOI:
--
发表时间:
2013
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
作者:
Andreas Abel;B. Pientka
通讯作者:
B. Pientka
DOI:
--
发表时间:
1994
期刊:
影响因子:
--
作者:
J. C. Reynolds
通讯作者:
J. C. Reynolds
DOI:
10.1145/2837614.2837665
发表时间:
2016
期刊:
Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
影响因子:
--
作者:
Sheng Chen;Martin Erwig
通讯作者:
Martin Erwig
DOI:
--
发表时间:
2006
期刊:
European Conference on Object-Oriented Programming
影响因子:
--
作者:
B. Emir;A. Kennedy;Claudio V. Russo;Dachuan Yu
通讯作者:
Dachuan Yu
DOI:
--
发表时间:
2010
期刊:
影响因子:
--
作者:
Martin Hirzel;P. Nagpurkar
通讯作者:
P. Nagpurkar