MPTCs and functional dependencies

Simon Peyton-Jones simonpj at microsoft.com
Thu Feb 2 06:36:34 EST 2006


I'm confident that it is premature to standardise functional
dependencies at this stage, very useful though they are.  If you doubt
me, read the JFP journal submission that Martin Sulzmann and Peter
Stuckey and I have been working on.
	http://research.microsoft.com/%7Esimonpj/papers/fd-chr
Fundeps are very, very tricky.

My own view is that associated types are a more promising way forward at
the programming language level.  They are a little less expressive than
fundeps, I think, but a whole lot less tricky.  But we don't have an
implementation of them yet, so we can hardly standardise them!

Multi-parameter type classes, yes.  Functional dependencies, no.

Simon

| -----Original Message-----
| From: haskell-prime-bounces at haskell.org
[mailto:haskell-prime-bounces at haskell.org] On Behalf Of
| Ross Paterson
| Sent: 02 February 2006 11:25
| To: haskell-prime at haskell.org
| Subject: MPTCs and functional dependencies
| 
| On Thu, Feb 02, 2006 at 11:38:07AM +0100, John Hughes wrote:
| > The problem with Haskell 98 is that it *lacks* features which
| > have become absolutely essential to Haskell programmers today. Those
| > features are what really *need* discussion and energy spent on them.
| >
| > [...]
| >
| >    Multi-parameter classes with functional dependencies
| >       - used everywhere... for example in monad transformers... so
| >         *must* be included this time
| >       - omitted from Haskell 98 because "the right design" wasn't
clear
| >       - it's still unclear! Functional dependencies *in some form*
| >         are essential, but associated types and datatypes look nicer
| >         in many ways!
| >       - is it too late, in practice, to replace fundeps by something
| >         else? How will we know? If we are to standardize on
associated
| >         types instead, we need a major effort to *make sure* all
| >         important applications of fundeps can be represented. How
will
| >         we organize that?
| 
| I agree that MPTCs are much less useful (though not completely
useless)
| without something like FDs or associated types.  But the specification
| of FDs is far from clear: the system described in Mark's paper is
quite
| a bit weaker than what is implemented by GHC and (more shakily) by
Hugs.
| It seems that associated types aren't ready yet, but I don't think FDs
| are either, accustomed as people are to them.
| 
| I have another worry about MPTCs.  They require require relaxations on
| the form of instances (FlexibleInstances on the wiki), which in turn
| require relaxations on contexts and thus deferred context reduction
(see
| FlexibleContexts).  The result is that missing instances get reported
| later than they do now.  MPTCs are very useful and probably necessary,
| but there is a cost.
| 
| _______________________________________________
| Haskell-prime mailing list
| Haskell-prime at haskell.org
| http://haskell.org/mailman/listinfo/haskell-prime


More information about the Haskell-prime mailing list