[ACM Press the 20th ACM SIGPLAN workshop - Austin, Texas, USA (2011.01.24-2011.01.25)] Proceedings of the 20th ACM SIGPLAN workshop on Partial evaluation and program manipulation - PERM '11 - Type classes in functional logic programming
โ Scribed by Martin-Martin, Enrique
- Book ID
- 125332459
- Publisher
- ACM Press
- Year
- 2011
- Weight
- 600 KB
- Category
- Article
- ISBN
- 1450304850
No coin nor oath required. For personal study only.
โฆ Synopsis
Type classes provide a clean, modular and elegant way of writing overloaded functions. Functional logic programming languages (FLP in short) like Toy or Curry have adopted the Damas-Milner type system, so it seems natural to adopt also type classes in FLP. However, type classes has been barely introduced in FLP. A reason for this lack of success is that the usual translation of type classes using dictionaries presents some problems in FLP like the absence of expected answers due to a bad interaction of dictionaries with the call-time choice semantics for non-determinism adopted in FLP systems.In this paper we present a type-passing translation of type classes based on type-indexed functions and type witnesses that is well-typed with respect to a new liberal type system recently proposed for FLP. We argue the suitability of this translation for FLP because it improves the dictionary-based one in three aspects. First, it obtains programs which run as fast or faster-with an speedup from 1.05 to 2.30 in our experiments. Second, it solves the mentioned problem of missing answers. Finally, the proposed translation generates shorter and simpler programs.
๐ SIMILAR VOLUMES