[removed boilerplate code when pattern matching Tuples and Lists and ther ConX equivalents
martin.hofmann@uni-bamberg.de**20090409141021] hunk ./src/Syntax/Expressions.hs 62
+    sameSymAtRoot (CondE c1 t1 e1) (CondE c2 t2 e2)        = True     
+    sameSymAtRoot (InfixE _ e1 _) (InfixE _ e2 _)          = e1 == e2
+    -- tuples
hunk ./src/Syntax/Expressions.hs 66
+    sameSymAtRoot t@(AppE _ _ )(TupE vs)                   = case head.unfoldAppE $ t of
+                                                                (ConE n) -> isTuple n (length vs)
+                                                                _owise  -> False
+    sameSymAtRoot (TupE vs) t@(AppE _ _ )                 = case head.unfoldAppE $ t of
+                                                                (ConE n) -> isTuple n (length vs)
+                                                                _owise  -> False
hunk ./src/Syntax/Expressions.hs 73
+    -- empty Lists
hunk ./src/Syntax/Expressions.hs 75
+    sameSymAtRoot (ConE n) (ListE [])                      = isNil n
+    sameSymAtRoot (ListE [])(ConE n)                       = isNil n
+    -- empty list and other (if other is a (:) list it matches default clause)
hunk ./src/Syntax/Expressions.hs 80
+    -- non-empty lists
hunk ./src/Syntax/Expressions.hs 82
-    sameSymAtRoot (CondE c1 t1 e1) (CondE c2 t2 e2)        = True     
-    sameSymAtRoot (InfixE _ e1 _) (InfixE _ e2 _)          = e1 == e2 
+    sameSymAtRoot (ListE _) t@(AppE _ _ )                  = case head.unfoldAppE $  t of
+                                                                (ConE n) -> isCons n
+                                                                _owise  -> False
+    sameSymAtRoot t@(AppE _ _ )(ListE _)                   = case head.unfoldAppE $ t of
+                                                                (ConE n) -> isCons n
+                                                                _owise  -> False 
hunk ./src/Syntax/Expressions.hs 89
+    
+    substitute s Root _ = s
+    substitute s pos t =
+        case pos of
+            (P i)     -> maybe t id $  moveToSubtermE t i (Just.(substitute s Root))
+            (Dot p i) -> maybe t id $  moveToSubtermE t i (Just.(substitute s p))
+            
+    subterms (VarE _)                        = []
+    subterms (ConE _)                        = []
+    subterms (LitE _)                        = []
+    subterms (TupE vals)                     = vals
+    subterms t@(AppE _ _ )                   = unfoldAppEargs t
+    subterms (ListE [])                      = []
+    subterms (ListE (l:ls))                  = [l, ListE ls] 
+    subterms (CondE e1 e2 e3)                = [e1, e2, e3]    
+    subterms (InfixE (Just e1) e2 (Just e3)) = [e1, e2, e3]
+    subterms (InfixE Nothing e2 (Just e3))   = [hole, e2, e3]
+    subterms (InfixE (Just e1) e2 Nothing)   = [e1, e2, hole]
+    subterms (InfixE Nothing e2 Nothing)     = [hole, e2, hole]
+    subterms    e                            = 
+        error $ "Terms.subterms: Not implemented for Expression " ++ (show e)
+       
+    isVar (VarE _) = True
+    isVar _        = False
+
hunk ./src/Syntax/Expressions.hs 143
-              
-    substitute s Root _ = s
-    substitute s pos t =
-        case pos of
-            (P i)     -> maybe t id $  moveToSubtermE t i (Just.(substitute s Root))
-            (Dot p i) -> maybe t id $  moveToSubtermE t i (Just.(substitute s p))
-            
-    subterms (VarE _)                        = []
-    subterms (ConE _)                        = []
-    subterms (LitE _)                        = []
-    subterms (TupE vals)                     = vals
-    subterms t@(AppE _ _ )                   = unfoldAppEargs t
-    subterms (ListE [])                      = []
-    subterms (ListE (l:ls))                  = [l, ListE ls] 
-    subterms (CondE e1 e2 e3)                = [e1, e2, e3]    
-    subterms (InfixE (Just e1) e2 (Just e3)) = [e1, e2, e3]
-    subterms (InfixE Nothing e2 (Just e3))   = [hole, e2, e3]
-    subterms (InfixE (Just e1) e2 Nothing)   = [e1, e2, hole]
-    subterms (InfixE Nothing e2 Nothing)     = [hole, e2, hole]
-    subterms    e                            = 
-        error $ "Terms.subterms: Not implemented for Expression " ++ (show e)
-       
-    isVar (VarE _) = True
-    isVar _        = False
-            
+                          
hunk ./src/Syntax/Patterns.hs 37
-    sameSymAtRoot (VarP _) (VarP _)                        = True
-    sameSymAtRoot (ConP c1 _) (ConP c2 _)                  = (c1 == c2)
-    sameSymAtRoot (LitP l1) (LitP l2)                      = l1 == l2
-    sameSymAtRoot (TupP v1s)(TupP v2s)                     = (length v1s) == (length v2s)
+    sameSymAtRoot (VarP _) (VarP _)                       = True
+    sameSymAtRoot (ConP c1 _) (ConP c2 _)                 = (c1 == c2)
+    sameSymAtRoot (LitP l1) (LitP l2)                     = l1 == l2
+    sameSymAtRoot (TupP v1s)(TupP v2s)                    = (length v1s) == (length v2s)
+    sameSymAtRoot (ConP n _) (TupP l)                     = isTuple n (length l)
+    sameSymAtRoot (TupP l)(ConP n _)                      = isTuple n (length l)
+    -- empty Lists    
hunk ./src/Syntax/Patterns.hs 45
+    sameSymAtRoot (ListP [])(ConP n [])                   = isNil n
+    sameSymAtRoot (ConP n [])(ListP [])                   = isNil n
+    -- empty and other
hunk ./src/Syntax/Patterns.hs 49
-    sameSymAtRoot (ListP _ )(ListP [])                    = False     
-    sameSymAtRoot (ListP _ )(ListP _ )                    = True     
+    sameSymAtRoot (ListP _ )(ListP [])                    = False   
+    -- cons lists
+    sameSymAtRoot (ListP _ )(ListP _ )                    = True   
+    sameSymAtRoot (ListP _ )(ConP n _)                    = isCons n   
+    sameSymAtRoot (ConP n _)(ListP _ )                    = isCons n
+         
hunk ./src/Syntax/Terms.hs 18
-    
+    isTuple, isNil, isCons,
hunk ./src/Syntax/Terms.hs 270
+isTuple :: Name -> Int -> Bool
+isTuple n i
+    | i == 2  = n == '(,)
+    | i == 3  = n == '(,,)
+    | i == 4  = n == '(,,,)
+    | i == 5  = n == '(,,,,)
+    | i == 6  = n == '(,,,,,)
+    | i == 7  = n == '(,,,,,,)
+    | i == 8  = n == '(,,,,,,,)
+    | i == 9  = n == '(,,,,,,,,)
+    | i == 10  = n == '(,,,,,,,,,)
+    | i == 11  = n == '(,,,,,,,,,,)
+    | i == 12  = n == '(,,,,,,,,,,,)
+    | i == 13  = n == '(,,,,,,,,,,,,)
+    | i == 14  = n == '(,,,,,,,,,,,,,)
+    | i == 15  = n == '(,,,,,,,,,,,,,,)
+    
+isNil :: Name -> Bool
+isNil = (==) '[]
+
+isCons :: Name -> Bool
+isCons = (==) '(:)
hunk ./src/Syntax/Types.hs 8
+import Data.Function (on)
hunk ./src/Syntax/Types.hs 26
-    sameSymAtRoot t1 t2 = error "sameSymAtRoot for Type not imlemented"
-    subterms _ =  error "subterms for Type not imlemented"
+    sameSymAtRoot (VarT _) (VarT _)           = True
+    sameSymAtRoot (ConT n1) (ConT n2)         = n1 == n2
+    -- tuples
+    sameSymAtRoot (TupleT i1) (TupleT i2)     = i1 == i2
+    sameSymAtRoot (TupleT i) (ConT n)         = isTuple n i
+    sameSymAtRoot (ConT n)(TupleT i)          = isTuple n i
+    -- lists
+    sameSymAtRoot ListT ListT                 = True
+    sameSymAtRoot ListT (ConT n)              = isNil n
+    sameSymAtRoot (ConT n) ListT              = isNil n
+    
+    sameSymAtRoot ArrowT ArrowT               = True
+    sameSymAtRoot (ForallT _ _ t1) t2         = sameSymAtRoot t1 t2
+    sameSymAtRoot t1 (ForallT _ _ t2)         = sameSymAtRoot t1 t2
+    sameSymAtRoot t1@(AppT _ _) t2@(AppT _ _) = on (==) (head.unfoldAppT) t1 t2
+    sameSymAtRoot _ _                         = False
+    
+    
+    subterms (ForallT _ _ t) = subterms t
+    subterms t@(AppT _ _)    = unfoldAppTargs t
+    subterms _               = []
+    
hunk ./src/Syntax/Types.hs 53
---    getVars t@(VarT _) = [t]
---    getVars (AppT t1 t2) = (getVars t1) `union` (getVars t2)
---    getVars _   = [] -- VarT, ConT, TupltT, ArrowT,ListT
-    
hunk ./src/Syntax/Unifier.hs 176
-            (op:args) ->
-                if op == (ConE '(,)) && (length s) == (length args) ||
-                   op == (ConE '(,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,,)) && (length s) == (length args) 
+            ((ConE n):args) ->
+                if isTuple n  (length s)  
hunk ./src/Syntax/Unifier.hs 181
-    match t@(AppE _ _)(TupE s)              = 
+    match t@(AppE _ _)(TupE s)              =      
hunk ./src/Syntax/Unifier.hs 183
-            (op:args) ->
-                if op == (ConE '(,)) && (length s) == (length args) ||
-                   op == (ConE '(,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,,)) && (length s) == (length args) 
+            ((ConE n):args) ->
+                if isTuple n  (length s) 
hunk ./src/Syntax/Unifier.hs 194
-        | c == (ConE '[])                   = return ()
+        | isNil n                           = return ()
hunk ./src/Syntax/Unifier.hs 197
-        | c == (ConE '[])                   = return ()
+        | isNil n                           = return ()
hunk ./src/Syntax/Unifier.hs 201
-            (op:a1:[a2]) ->
-                if op == (ConE '(:))
+            ((ConE n):a1:[a2]) ->
+                if isCons n
hunk ./src/Syntax/Unifier.hs 208
-            (op:a1:[a2]) ->
-                if op == (ConE '(:))
+            ((ConE n):a1:[a2]) ->
+                if isCons n
hunk ./src/Syntax/Unifier.hs 247
-            (op:args) ->
-                if op == (ConE '(,)) && (length s) == (length args) ||
-                   op == (ConE '(,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,,)) && (length s) == (length args) 
+            ((ConE n):args) ->
+                if isTuple n  (length s) 
hunk ./src/Syntax/Unifier.hs 254
-            (op:args) ->
-                if op == (ConE '(,)) && (length s) == (length args) ||
-                   op == (ConE '(,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,)) && (length s) == (length args) ||
-                   op == (ConE '(,,,,,,,,,,)) && (length s) == (length args) 
-                  then mapM_ (uncurry unify) (zip args s)
+            ((ConE n):args) ->
+                if isTuple n  (length s) 
+                  then mapM_ (uncurry unify) (zip s args)
hunk ./src/Syntax/Unifier.hs 339
-        |n == '[]                         = return ()
+        | isNil n                       = return ()
hunk ./src/Syntax/Unifier.hs 342
-        |n == '[]                         = return ()
+        | isNil n                         = return ()
hunk ./src/Syntax/Unifier.hs 345
-        |n == '(:)                        = match s p >> match (ListP ss) ps
+        | isCons n                        = match s p >> match (ListP ss) ps
hunk ./src/Syntax/Unifier.hs 348
-        | n == '(:)                       = match s p >> match (ListP ss) ps
+        | isCons n                        = match s p >> match (ListP ss) ps
hunk ./src/Syntax/Unifier.hs 357
-    match (ConP n p) (TupP t) 
-        | n == '(,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | n == '(,,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip p t)
-        | otherwise                    = flush "No Match!"      
-    match (TupP t)(ConP n p) 
-        | n == '(,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | n == '(,,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry match) (zip t p)
-        | otherwise                    = flush "No Match!"      
+    match (ConP n p) (TupP t)              
+        | isTuple n (length t)            = mapM_ (uncurry match) (zip p t)
+        | otherwise                       = flush "No Match!"      
+    match (TupP t)(ConP n p)               
+        | isTuple n (length t)            = mapM_ (uncurry match) (zip p t)
+        | otherwise                       = flush "No Match!"      
hunk ./src/Syntax/Unifier.hs 383
-        | n == '[]                     = return ()
+        | isNil n                      = return ()
hunk ./src/Syntax/Unifier.hs 386
-        |n == '[]                      = return ()
+        | isNil n                       = return ()
hunk ./src/Syntax/Unifier.hs 389
-        |n == '(:)                     = unify s p >> unify (ListP ss) ps
+        | isCons n                     = unify s p >> unify (ListP ss) ps
hunk ./src/Syntax/Unifier.hs 392
-        | n == '(:)                    = unify s p >> unify (ListP ss) ps
+        | isCons n                    = unify s p >> unify (ListP ss) ps
hunk ./src/Syntax/Unifier.hs 401
-        | n == '(,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
-        | n == '(,,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip p t)
+        | isTuple n (length t) = mapM_ (uncurry unify) (zip p t)
hunk ./src/Syntax/Unifier.hs 404
-        | n == '(,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
-        | n == '(,,,,,,,,,) && (length p) == (length t) = mapM_ (uncurry unify) (zip t p)
+        | isTuple n (length t) = mapM_ (uncurry unify) (zip p t)