Changes between Version 73 and Version 74 of TypeFunctionsSolving


Ignore:
Timestamp:
Sep 3, 2008 2:49:53 PM (6 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeFunctionsSolving

    v73 v74  
    199199 
    200200propagate :: [RewriteInst] -> [RewriteInst] 
    201 propagate eqs = snd (prop eqs []) 
     201propagate eqs = prop eqs [] 
    202202  where 
    203     prop :: [RewriteInst] -> [RewriteInst] -> [RewriteInst] 
    204     prop [] res = res 
     203    prop :: [RewriteInst]  -- todo list (still need to try these equalities) 
     204         -> [RewriteInst]  -- residual list (tried all equalities here already pairwise) 
     205         -> [RewriteInst]  -- these permit no further rule application 
     206    prop []       res = res 
    205207    prop (eq:eqs) res = apply eq eqs res 
    206208 
    207     apply eq@[[co :: F t1..tn ~ t]] eqs res  
    208       | Just eq' <- applyTop eq = prop (norm eq' ++ eqs) res 
    209       | otherwise        = mapRule (applySubstFam eq) -- TODO!!! 
     209    apply eq eqs res  
     210      | Just eq' <- applyTop eq 
     211     = prop (norm eq' ++ eqs) res 
     212      | otherwise 
     213      = let (new_eqs, unchanged_eqs) = mapAndUnzip (applySubstRules eq) eqs 
     214            (new_res, unchanged_res) = mapAndUnzip (applySubstRules eq) res 
     215        in prop (concat new_eqs ++ concat new_res ++ concat unchanged_eqs) 
     216                (eq : concat unchanged_res) 
     217 
     218  applySubstRules eq1 eq2 
     219    | Just eq2' <- applySubstFam eq1 eq2    = (norm eq2', []) 
     220    | Just eq2' <- applySubstVarVar e1 eq2  = (norm eq2', []) 
     221    | Just eq2' <- applySubstVarFam eq1 eq2 = ([eq2'], []) 
     222    | otherwise                             = ([], [eq2]) 
    210223}}} 
    211224