Hostname: page-component-5db58dd55d-8mwbx Total loading time: 0 Render date: 2026-05-25T15:13:45.899Z Has data issue: false hasContentIssue false

COCHIS: Stable and coherent implicits

Published online by Cambridge University Press:  08 February 2019

TOM SCHRIJVERS
Affiliation:
Department of Computer Science, KU Leuven, Leuven, Belgium (e-mail: tom.schrijvers@cs.kuleuven.be)
BRUNO C.D.S. OLIVEIRA
Affiliation:
Department of Computer Science, The University of Hong Kong, Hong Kong (e-mail: bruno@cs.hku.hk)
PHILIP WADLER
Affiliation:
School of Informatics, University of Edinburgh, Edinburgh, UK (e-mail: wadler@inf.ed.ac.uk)
KOAR MARNTIROSIAN
Affiliation:
Department of Computer Science, KU Leuven, Leuven, Belgium (e-mail: klara.mar@cs.kuleuven.be)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

Implicit programming (IP) mechanisms infer values by type-directed resolution, making programs more compact and easier to read. Examples of IP mechanisms include Haskell’s type classes, Scala’s implicits, Agda’s instance arguments, Coq’s type classes and Rust’s traits. The design of IP mechanisms has led to heated debate: proponents of one school argue for the desirability of strong reasoning properties, while proponents of another school argue for the power and flexibility of local scoping or overlapping instances. The current state of affairs seems to indicate that the two goals are at odds with one another and cannot easily be reconciled. This paper presents COCHIS, the Calculus Of CoHerent ImplicitS, an improved variant of the implicit calculus that offers flexibility while preserving two key properties: coherence and stability of type substitutions. COCHIS supports polymorphism, local scoping, overlapping instances, first-class instances and higher-order rules, while remaining type-safe, coherent and stable under type substitution. We introduce a logical formulation of how to resolve implicits, which is simple but ambiguous and incoherent, and a second formulation, which is less simple but unambiguous, coherent and stable. Every resolution of the second formulation is also a resolution of the first, but not conversely. Parts of the second formulation bear a close resemblance to a standard technique for proof search called focusing. Moreover, key for its coherence is a rigorous enforcement of determinism.

Information

Type
Regular Paper
Copyright
© Cambridge University Press 2019 
Submit a response

Discussions

No Discussions have been published for this article.