Changes between Version 17 and Version 18 of FunctionalDependencies


Ignore:
Timestamp:
Apr 10, 2006 1:15:30 AM (8 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FunctionalDependencies

    v17 v18  
    124124class C a b c | a -> b where f :: a -> b -> c -> Bool 
    125125 
    126 instance B a b => C [a] [b] Bool 
     126instance B a b => C [a] b Bool 
    127127}}} 
    128 Given the constraint ``C [a] [b] Bool, C [a] [c] d``, 
    129  * if we apply the dependency first, and then reduce using the instances, we obtain ``b = c, B a b, C [a] [b] d``. 
    130  * if we first reduce using the instances, we obtain ``B a b, C [a] [c] d``. 
     128Given the constraint ``C [a] b Bool, C [a] c d``, 
     129 * if we apply the dependency first, and then reduce using the instances, we obtain ``b = c, B a b, C [a] b d``. 
     130 * if we first reduce using the instances, we obtain ``B a b, C [a] b d``. 
    131131(GHC and Hugs yield the former, because they defer context reduction: see FlexibleContexts). 
    132132 
     
    163163(In the above confluence example, `d` is instantiated to `Bool` and both alternatives reduce to {{{b = c, d = Bool, B a b}}}). 
    164164 
    165 A restriction on instances to guarantee termination would also be needed. 
     165To guarantee termination, we would need to require that for any instance C t, each argument is either covered by t,,X,, or is a single variable.