Abstract
Comparing two types for equality is an essential ingredient for an implementation of dynamic types. Once equality has been established, it is safe to cast a value from one type to another. In a language with run-time type analysis, implementing such a procedure is fairly straightforward. Unfortunately, this naive implementation destructs and rebuilds the argument while iterating over its type structure. However, by using higher-order polymorphism, a casting function can treat its argument parametrically. We demonstrate this solution in two frameworks for ad-hoc polymorphism: intensional type analysis and Haskell type classes.
Publisher
Cambridge University Press (CUP)
Cited by
9 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Lambda: the ultimate sublanguage (experience report);Proceedings of the ACM on Programming Languages;2019-07-26
2. First-Class Subtypes;Electronic Proceedings in Theoretical Computer Science;2019-05-16
3. A Reflection on Types;A List of Successes That Can Change the World;2016
4. Dependently typed programming with singletons;ACM SIGPLAN Notices;2013-01-17
5. Non-parametric parametricity;Journal of Functional Programming;2011-09