[Haskell-cafe] Type Inference for Overloading without
carlos.camarao at gmail.com
Sun Jan 17 16:32:04 EST 2010
On Wed, Jan 13, 2010 at 7:57 AM, Peter Verswyvelen <bugfact at gmail.com>wrote:
> A while ago, someone provided me a link to the paper "Type Inference
> for Overloading without Restrictions"
> Although I don't understand everything in this paper, I wander what
> people's opinions are about this regarding a future Haskell language
> revision or extension?
System CT (as it was defined in the Flops99 paper) is a core system
for constrained (parametric + ad-hoc) polymorphism, the main
difference with respect to Haskell type classes being that it uses a
closed world approach to overloading (as it was defined in the Flops99
while Haskell type classes uses an open world.
Open means that principal types of overloaded symbols are explicitly
specified (in Haskell class declarations), and, informally speaking,
satisfiability checking is performed only when overloading is resolved
(i.e. satisfiability is delayed until it cannot be delayed any longer).
Closed, on the other hand, means that principal types are determined
(inferred) according to (definitions available in) the context (as
occurs in the normal case, of non-overloaded symbols).
For details, see e.g. .
A "mixed" approach, where annotation of types of overloaded symbols is
not mandatory but satisfiability checking is done as in an open world
approach, is possible and advantageous.
Only prototype implementations exist to this date of system CT.
A prototype implementation of a mixed approach is currently under way.
> Would a feature like this be preferable over typeclasses?
The main disadvantage of system CT's closed world approach is the cost
of satisfiability checking. (However, this does not hold in the case of a
approach, where satisfiability checking is restrictd as in an open world).
The main advantage is that annotations (type classes) need not be mandatory
and a priori determined by the programmer.
Would it be practical to implement?
Yes, I think so, in particular the mixed approach where satisfiability
delayed (it is done only if there exist "unreachable variables" in the
as explained in . We have recently sent a message with a link to our
describes this approach, as a proposal to solve Haskell's MPTC dilemma
the need of functional dependencies or another mechanism).
> Are people working on this?
Yes. We are.
> Peter Verswyvelen
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
 Open and Closed World Approaches to Overloading: a Definition and
Coexistence, Carlos Camarão, Cristiano Vasconcellos, Lucília Figueiredo,
Journal of Universal Computer Science 13(6), 854-873, 2007.
 A Solution to Haskell's Multi-paramemeter Type Class Dilemma,
Carlos Camarão, Rodrigo Ribeiro, Lucília Figueiredo, Cristiano
SBLP'2009 (13th Brazilian Symposium on Programming Languages), 2009.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe