Yet more on functional dependencies

Mark P Jones
Mon, 15 Jan 2001 02:01:27 -0800

| I am finding functional dependencies confusing.  (I suspect I am=20
| not alone.)  Should the following code work?
| class HasConverter a b | a -> b where
|    convert :: a -> b
| instance (HasConverter a b,Show b) =3D> Show a where
|    show value =3D 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!

All the best,