How to make ad-hoc polymorphism less ad hoc
POPL '89 Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
A system of constructor classes: overloading and implicit higher-order polymorphism
FPCA '93 Proceedings of the conference on Functional programming languages and computer architecture
Implementing Haskell overloading
FPCA '93 Proceedings of the conference on Functional programming languages and computer architecture
Semantics of type classes revisited
LFP '94 Proceedings of the 1994 ACM conference on LISP and functional programming
ACM Transactions on Programming Languages and Systems (TOPLAS)
Principal type-schemes for functional programs
POPL '82 Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
Guarded recursive datatype constructors
POPL '03 Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
A Demand Driven Computation Strategy for Lazy Narrowing
PLILP '93 Proceedings of the 5th International Symposium on Programming Language Implementation and Logic Programming
TOY: A Multiparadigm Declarative System
RtA '99 Proceedings of the 10th International Conference on Rewriting Techniques and Applications
Implementing Haskell Type Classes
Proceedings of the 1989 Glasgow Workshop on Functional Programming
Type Inference and Type Classes
Proceedings of the 1989 Glasgow Workshop on Functional Programming
Open data types and open functions
Proceedings of the 8th ACM SIGPLAN international conference on Principles and practice of declarative programming
A history of Haskell: being lazy with class
Proceedings of the third ACM SIGPLAN conference on History of programming languages
Multi-paradigm declarative languages
ICLP'07 Proceedings of the 23rd international conference on Logic programming
SSDGP'06 Proceedings of the 2006 international conference on Datatype-generic programming
Liberal typing for functional logic programs
APLAS'10 Proceedings of the 8th Asian conference on Programming languages and systems
New results on type systems for functional logic programming
WFLP'09 Proceedings of the 18th international conference on Functional and Constraint Logic Programming
Well-typed narrowing with extra variables in functional-logic programming
PEPM '12 Proceedings of the ACM SIGPLAN 2012 workshop on Partial evaluation and program manipulation
Transparent function types: clearing up opacity
Proceedings of the 14th symposium on Principles and practice of declarative programming
Hi-index | 0.00 |
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.