[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
article

Type-checking multi-parameter type classes

Published: 01 March 2002 Publication History

Abstract

Type classes are a novel combination of parametric polymorphism and constrained types. Although most implementations restrict type classes to be single-parameter, the generalization to multi-parameter type classes has gained increasing attention. A problem with multi-parameter type classes is the increased possibilities they introduce for ambiguity in inferred types, impacting their usefulness in many practical situations. A new type-checking strategy, domain-driven unifying resolution, is identified as an approach to solve these problems. Domain-driven unifying resolution is simple, efficient, and practically useful. However, even with severe restrictions on instance definitions, it is not possible to guarantee that type-checking with unifying resolution terminates. This is in contrast with the naive generalization of single parameter resolution strategies. Domain-driven unifying resolution is guaranteed to terminate if the type class constraints are satisfiable; however satisfiability is undecidable even with severe restrictions on instance definitions. These results shed some light on ambiguity problems with multi-parameter type classes.

References

[1]
Chen, K., Hudak, P. and Odersky, M. (1992) Parameteric type classes (extended abstract). Proceedings of ACM Symposium on Lisp and Functional Programming, pp. 170-181. ACM Press.
[2]
Cormack, G. and Wright, A. (1990) Type-dependent parameter inference. Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 127-136. ACM Press.
[3]
Dubois, C., Rouaix, F. and Weis, P. (1995) Extensional polymorphism. Proceedings of ACM Symposium on Principles of Programming Languages, ACM Press.
[4]
Hall, C., Hammond, K., Peyton-Jones, S. and Wadler, P. (1996) Type classes in Haskell. ACM Trans. Programming Langu. Syst. 18(2), 109-138.
[5]
Jones, M. (1991) An introduction to Gofer. Available via ftp from nebula.cs.yale.edu in pub/haskell/gofer.
[6]
Jones, M. (1992) Qualified Types: Theory and Practice. PhD thesis, Oxford University Computing Laboratory.
[7]
Jones, M. (1993) A system of constructor classes: Overloading and implicit higher-order polymorphism. Proceedings of ACM Symposium on Functional Programming and Computer Architecture: Lecture Notes in Computer Science 594, pp. 1-10. Springer-Verlag.
[8]
Jones, M. (1994) Re: Multiple parameter classes. E-mail message on Haskell mailing list.
[9]
Jones, M. (1995) Simplifying and improving qualified types Proceedings of ACM Symposium on Functional Programming and Computer Architecture. ACM Press.
[10]
Jones, M. (2000) Type classes with functional dependencies. European Symposium on Programming: Lecture Notes in Computer Science 1782. Springer-Verlag.
[11]
Kaes, S. (1988) Parametric overloading in polymorphic programming languages. In: D. Sannella, editor, European Symposium on Programming: Lecture Notes in Computer Science 300, pp. 131-144. Springer-Verlag.
[12]
Liang, S., Hudak, P. and Jones, M. (1995) Monad transformers and modular interpreters. Proceedings of ACM Symposium on Principles of Programming Languages, pp. 333-343. ACM Press.
[13]
Nipkow, T. and Prehofer, C. (1993) Type reconstruction for type classes. Proceedings of ACM Symposium on Principles of Programming Languages, pp. 409-418. ACM Press.
[14]
Nipkow, T. and Snelting, G. (1991) Type classes and overloading resolution via order-sorted unification. In: J. Hughes, editor, Proceedings of ACM Symposium on Functional Programming and Computer Architecture: Lecture Notes in Computer Science 523, pp. 1-14. Springer-Verlag.
[15]
Odersky, M., Wadler, P. and Wehr, M. (1995) A second look at overloading. Proc. ACM Conf. on Functional Programming and Computer Architecture, pp. 135-146.
[16]
Peyton-Jones, S. (1998) Multi-parameter type classes in GHC. URL: http:// research.microsoft.com/Users/simonpj/Haskell/multi-param.html.
[17]
Peyton-Jones, S., Jones, M. and Meijer, E. (1997) Type classes: an exploration of the design space. Haskell Workshop. Amsterdam, the Netherlands.
[18]
Volpano, D. and Smith, G. (1991) On the complexity of ML typability with overloading. In: J. Hughes, editor, Proceedings of ACM Symposium on Functional Programming and Computer Architecture: Lecture Notes in Computer Science 523, pp. 15-28. Springer-Verlag.
[19]
Wadler, P. and Blott, S. (1989) How to make ad-hoc polymorphism less ad-hoc. In: M. O'Donnell and S. Feldman, editors, Proceedings of ACM Symposium on Principles of Programming Languages, pp. 60-76. ACM Press.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Journal of Functional Programming
Journal of Functional Programming  Volume 12, Issue 2
March 2002
92 pages

Publisher

Cambridge University Press

United States

Publication History

Published: 01 March 2002

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 12 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Associated Effects: Flexible Abstractions for Effectful ProgrammingProceedings of the ACM on Programming Languages10.1145/36563938:PLDI(394-416)Online publication date: 20-Jun-2024
  • (2011)On the bright side of type classesProceedings of the 16th ACM SIGPLAN international conference on Functional programming10.1145/2034773.2034796(143-155)Online publication date: 19-Sep-2011
  • (2011)On the bright side of type classesACM SIGPLAN Notices10.1145/2034574.203479646:9(143-155)Online publication date: 19-Sep-2011
  • (2009)A foundation for flow-based program matchingACM SIGPLAN Notices10.1145/1594834.148089744:1(114-126)Online publication date: 21-Jan-2009
  • (2009)Type invariants for HaskellProceedings of the 3rd workshop on Programming languages meets program verification10.1145/1481848.1481855(39-48)Online publication date: 20-Jan-2009
  • (2009)A foundation for flow-based program matchingProceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages10.1145/1480881.1480897(114-126)Online publication date: 21-Jan-2009
  • (2007)Understanding functional dependencies via constraint handling rulesJournal of Functional Programming10.1017/S095679680600613717:1(83-129)Online publication date: 1-Jan-2007
  • (2005)A theory of overloadingACM Transactions on Programming Languages and Systems10.1145/1108970.110897427:6(1216-1269)Online publication date: 1-Nov-2005
  • (2004)Constraint-set satisfiability for overloadingProceedings of the 6th ACM SIGPLAN international conference on Principles and practice of declarative programming10.1145/1013963.1013974(67-77)Online publication date: 24-Aug-2004

View Options

View options

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media