Haskell-prime Digest, Vol 2, Issue 6

John Hughes rjmh at cs.chalmers.se
Thu Feb 2 09:36:15 EST 2006


>From: Henrik Nilsson <nhn at Cs.Nott.AC.UK>
>Subject: Re: MPTCs and functional dependencies
>
>
>Simon PJ wrote:
>
> > Multi-parameter type classes, yes.  Functional dependencies, no.
>
>My experience is that even with very simple applications of MPTCs,
>I often end up needing functional dependencies to make things work.
>
>Thus, if my hunch is right, and other people have a similar experience,
>my fear would be that omitting FDs or something similar would result
>in a Haskell' standard that ends up being out of date even before it is
>finalised, in that a large number of real world applications and
>libraries would fail to be standard compliant and could not easily
>be adapted to be.
>
>  
>
I second that. For example, my survey showed that the monadic combinators
in Control.Monad.* are quite heavily used. These libraries define three
two-parameter classes (MonadError, MonadReader, and MonadWriter).
ALL of them use functional dependencies. I remember trying to program
this kind of library before the days of FDs--the result was worthless, 
because of all
the ambiguities I got whenever I tried to use it.

Adding MPTCs without *some* form of FDs (and I'm including the associated
types stuff there) would guarantee a broken language from the start.

I agree this needs work--in my view, some of the most important work to be
done in defining Haskell'. We need something simple enough to standardize,
which is at the same time powerful enough to handle the applications we
already have.

We didn't dare include MPTCs in Haskell 98 because the number one goal
on that occasion was to be conservative! But if we had taken that view when
Haskell was first designed, classes would never have seen the light of 
day at
all. I think now is the time to bite this bullet.

John




More information about the Haskell-prime mailing list