The right kind of generic programming
The right kind of generic programming
复制标题
正确的泛型编程类型
DOI:
--
复制
发表时间:
2012
期刊:
影响因子:
--
通讯作者:
José Pedro Magalhães
中科院分区:
文献类型:
--
作者:
José Pedro Magalhães
Haskell is known for its strong, static type system. A good type system classifies values, constraining the valid terms of the language and preventing many common programming errors. The Glasgow Haskell Compiler (GHC) has further extended the type language of Haskell, adding support for type-level computation and explicit type equality constraints.
Type-level programming is used to classify values, but types themselves have remained notoriously unclassified. Recently, however, the kind-level language was extended with support for user-defined kinds and kind polymorphism. In this paper we revisit generic programming approaches that rely heavily on type-level computation, and analyse how to improve them with the extended kind language. For instructive purposes, we list a series of advantages given by the new features, and also a number of shortcomings that prevent desirable use patterns.