[compare the number of ctor symbols when matching to get calling relation
martin.hofmann@uni-bamberg.de**20090519081910] hunk ./src/Data/Rules.hs 66
-    
+
+instance Pretty Rule where
+    pretty = text.pprint.rule2clause
+    -- Need the TH.PprLib to get the correct variable names on lhs and rhs
+        
hunk ./src/Data/Rules.hs 193
-
-instance Pretty Rule where
-	pretty = text.pprint.rule2clause
-    -- Need the TH.PprLib to get the correct variable names on lhs and rhs
-  
+   
hunk ./src/RuleDevelopment/Matching.hs 87
-    let callrel = on compare (lhs.crul) tgt cll
+    let callrel = on compareSizeLinear (lhs.crul) tgt cll
hunk ./src/Syntax/Expressions.hs 132
+    
+instance Size TExp where
+    sizeS (TVarE _ _)       = (+1)
+    sizeS (TConE _ _)       = (+1)
+    sizeS (TLitE _ _)       = (+1)
+    sizeS (TWildE _ _)      = (+1)
+    sizeS (TAppE a1 a2 _)   = (sizeS a1).(sizeS a2)
+    sizeS (TInfixE l c r _) = (sizeS l).(sizeS c).(sizeS r)
+    sizeS (TTupE l _)       = sizeS l
+    sizeS (TListE l _)      = sizeS l
+    sizeS (TCondE c t e _)  = (sizeS c).(sizeS t).(sizeS e)
hunk ./src/Syntax/Terms.hs 14
-    --Size(..),
+    Size(..), compareSizeLinear, compareSizePairwise,
hunk ./src/Syntax/Terms.hs 76
---class Size t where
---    size :: t -> Int
---    size = size_ 0 
---    
---    size_ :: Int -> t -> Int
---    
---instance Size Exp where
---    size_ done (VarE _)             = done + 1
---    size_ done (ConE _)             = done + 1
---    size_ done (LitE _)             = done + 1
---    size_ done (TupE vals)          = sum $ (done + 1):(map size vals)
---    size_ done t@(AppE e1 e2 )      = sum $ (done + 1):(map size (unfoldAppEargs t))
---    size_ done (ListE l)            = sum $ (done + 1):(map size l)
---    size_ done (CondE e1 e2 e3)     = sum $ (done + 1):(map size [e1, e2, e3])    
---    size_ done (InfixE e1 _ e2)     = sum $ (done + 1):(map size (concatMap maybeToList[e1,e2]))
---    size_ _  e                      = 
---        error $ "Terms.Class.size: Not implemented for Expression " ++ (show e)
---
---instance Size Pat where
---    size_ done (VarP _)         = done + 1
---    size_ done (LitP _)         = done + 1
---    size_ done (ConP _ pats)    = sum $ (done + 1):(map size pats)
---    size_ done (InfixP p1 _ p2) = sum $ (done + 1):(map size [p1,p2] )
---    size_ done (ListP pats)     = sum $ (done + 1):(map size pats)
---    size_ done (TupP pats)      = sum $ (done + 1):(map size pats)
---    size_ _    p                = 
---        error $ "Terms.Class.size: Not implemented for Pattern " ++ (show p)
---
---instance Size [Pat] where
---    size_ done ps = foldr (\p d -> (size p) + d ) done ps
---    
----- testing
---
---instance Size Int where
---    size_ a b= a+b
---instance Size String where
---    size_ a b = a + length b
hunk ./src/Syntax/Terms.hs 77
+-- | Count the ctor symbols in a term
+class Size t where
+    size :: t -> Int
+    size = flip sizeS 0 
+    
+    sizeS :: t -> Int -> Int
+    
+instance Size t => Size [t] where
+    sizeS l = (+ (foldl (flip sizeS) 0 l))
+
+compareSizeLinear :: (Size t) => [t] -> [t] -> Ordering
+compareSizeLinear = compare `on` size  
+  
+compareSizePairwise :: (Size t) => [t] -> [t] -> Ordering
+compareSizePairwise [x] [y] = on compare size x y
+compareSizePairwise (x:xs) (y:ys)
+    | on compare size  x y == EQ = compareSizePairwise xs ys
+    | otherwise                  = on compare size x y
hunk ./src/SynthesisEngine.hs 48
-    return $ hypos2decs result
-
--- WAS
---startSynthesis :: Q [Dec] -> Q [Dec] -> IO()
---startSynthesis a b = runQ $
---    do tgt <- a
---       bgk <- b  
---       runIO $ printResult $ (runLM  (synthesise tgt bgk)) 
---
---synthesise :: [Dec] -> [Dec] -> LM [[Dec]]
---synthesise tgtsQ bgksQ = do
---    let tgts     =  decs2rules tgtsQ --  [(Name,Rules)]
---    let bgks     =  decs2rules bgksQ
---    let tnms     =  (map fst) tgts
---    let allrs    =  (++) tgts bgks 
---    let igordata = initIgor allrs
---    result       <- (runIM ( synthesiseTargets tnms) igordata) 
---    return $ hypos2decs result
---       
+    return $ hypos2decs result       
hunk ./src/UI/UIStarter.hs 76
-    , dumpDir   = "log/"
+    , dumpDir   = "."