Syntax of functional dependencies
Simon Marlow
simonmar@microsoft.com
Fri, 26 Apr 2002 09:47:35 +0100
> I errorneously specified categories as
>=20
> class (Eq object, Eq morphism) =3D>=20
> Category id object morphism | id ->, id -> morphism
> where o :: id -> morphism -> morphism -> Maybe morphism
> dom, cod :: id -> morphism -> object
>=20
> it should have been
>=20
> class (Eq object, Eq morphism) =3D>=20
> Category id object morphism | id -> object, id -> morphism
> ... ^^^^^^
>=20
> - but ghci 5.02.2 does not complain. Why?
The syntax of a functional dependency is (from GHC's parser):
fd : varids0 '->' varids0
varids0=20
: {- empty -}
| varids0 tyvar
so the list of tyvars on either side of the '->' can be empty.
Functional dependency experts can correct me if I'm wrong, but I imagine
though that 'a ->' is not a very useful functional dependency (isn't it
the same as giving no functional dependency at all?), and '-> a' means
that there can only ever be one instantiation for 'a' in the whole
program.
Cheers,
Simon