Problem with functional dependencies

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
3 Jan 2001 18:40:30 GMT


I don't fully understand fundeps. Would the following transform
legal programs (without overlapping instances) into legal programs?
I hope yes.

Let's imagine a class with a set of instances and uses, without
fundeps.

- Add some additional type variables to the class header.
- Add a fundep: all old type variables -> all new type variables.
- For each instance, in places corresponding to new type variables
  write arbitrary types.
- For each constraint based on this class, in places corresponding
  to new type variables write unique type variables.

In particular, should the following be legal:

class C a b c | a -> b c
instance C [a] b b
f:: C [a] b c => a
f = undefined

ghc panics and Hugs rejects it.

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK