MPTCs and functional dependencies

Simon Peyton-Jones simonpj at microsoft.com
Tue Mar 28 08:32:04 EST 2006


My current take, FWIW.

* MPTCs are very useful.  They came along very rapidly (well before
H98).  I think we must put them in H'

* But MPTCs are hamstrung without FDs or ATs

* FDs and ATs are of the same order of technical difficulty, as Martin
says

* ATs are (I believe) a bit weaker from the expressiveness point of view
(zip example), but are (I believe) nicer to program with.  

* BUT we have way more experience with actually programming with FDs.
ATs fail the "well-established" test by a mile.

* Largely due to Martin's work, we now have a much better handle on just
what restrictions on FDs make type inference tractable.  So I believe
there is a solid MPTC+FD story that we could embody in H'.

* Medium term, I think ATs may *at the programming-language level*
displace FDs, because they are nicer to program with.  But that's just
my opinion, and we don't have enough experience to know one way or the
other.


Tentative conclusion: H' should have MPTC + FDs, but not ATs.

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