MPTCs and functional dependencies
ross at soi.city.ac.uk
Thu Feb 2 06:25:18 EST 2006
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.
More information about the Haskell-prime