Yet more on functional dependencies

Jeffrey R. Lewis jeff@galconn.com
Mon, 15 Jan 2001 08:36:52 -0800


Mark P Jones wrote:

> | I am finding functional dependencies confusing.  (I suspect I am
> | not alone.)  Should the following code work?
> |
> | class HasConverter a b | a -> b where
> |    convert :: a -> b
> |
> | instance (HasConverter a b,Show b) => Show a where
> |    show value = show (convert value)
>
> It's a separate issue.  There's no reason why a system using
> functional dependencies *should* support this.  But it is an
> attractive and useful extension that such a system would
> probably *want* to include.  (i.e., it's a desirable feature,
> not a requirement.)
>
> I typed your example into Hugs on my machine and it seemed to
> accept the syntax (which suggests that the implementation is
> intended to allow this kind of thing).  But then it choked on
> the definition with a curious error message that I suspect is
> an indication of a bug in Hugs' treatment of functional
> dependencies.  And, for that reason, I'm crossposting this
> message to hugs-bugs.  [Let me take the opportunity to remind
> good readers of these lists that it is now more than a year
> since I retired from the joys of maintaining Hugs, so I'm not
> planning to try and track down the source of this bug myself!]
> Of course, it could be that my version of Hugs is out of date!

Could you share the error message please.  Boy, even old maintainers don't know how to submit a bug report...  ;-)

Actually, I suspect whatever the problem was has been fixed, because (with -98 +o), it compiles fine. (I'm using the bleeding edge, out-of-the-repository version.)

--Jeff