[Haskell-cafe] looking for examples of non-full Functional Dependencies

Martin Sulzmann martin.sulzmann at gmail.com
Thu Apr 17 08:59:23 EDT 2008


Sittampalam, Ganesh wrote:
>>> Why not instead transform single-range FDs into multi-range ones where 
>>> possible?
>>>       
>
>   
>> That's a perfectly reasonable assumption and would establish the logical property that
>>     
>
>   
>> a -> b /\ a -> c   iff a -> b /\ c
>>     
>
>   
>> for FDs (by definition).
>>     
>
>   
>> But what about programmers who'd like that
>>     
>
>   
>> C [x] y z   yields the improvement y = [b], z =[b]
>>     
>
>   
>> where
>>     
>
>   
>> class C a b c | a -> b c
>> instance C a b b => C [a] [b] [b]
>>     
>
> Isn't that precisely what you earlier said would happen with multi-range FDs?
> Either I'm missing some difference or we're talking at cross-purposes.
>
> My suggestion is that
>
> "class C a b c | a -> b c" and "class C a b c | a -> b, a -> c" be both
> treated as the former case, leading to both cases having the y=[b],z=[b]
> improvement as above.
>
>   

Misunderstanding. I see what you mean. Yes, I agree let's consider

 a -> b, a -> c as equivalent to a -> b c  (I argued the other direction 
in my earlier email).

One subtle point (Tom and I just discussed).

It could happen that the programmer writes

class SuperCtxt => C a b c | a -> b

but there could be an implicit dependency a -> c
arising from the super class context SuperCtxt.
Hence, you suddenly get a -> b c.

The problem is to generate the proper improvement rules.
Well, it's not hard to generate these rules we just need to make
sure that the rules generated match the programmers intuition
how functional dependencies behave.

Martin






More information about the Haskell-Cafe mailing list