[Removed the code that renamed wildcards uniquely
tobias@goedderz.info**20150311111250
 Ignore-this: 840026c5697c0d6ca621e382953ca285
 
 As it's not possible to avoid duplicate names during unification completely,
 it's pointless to make some variables unique. This greatly simplifies and speeds
 up the introduction of wildcards.
] hunk ./src/Igor2/Data/Rules.hs 43
-import Syntax hiding (sameSymAt, mapTermM)
-import qualified Syntax as T (sameSymAt, mapTermM)
+import Syntax hiding (sameSymAt, mapTermM, mapTerm)
+import qualified Syntax as T (sameSymAt, mapTermM, mapTerm)
hunk ./src/Igor2/Data/Rules.hs 65
-mkRule (UnGuardEq lhs rhs) = rule lhs . fst $
-    CMState.runState (undefinedToWildcard rhs) newRenameState
+mkRule (UnGuardEq lhs rhs) = rule lhs $ T.mapTerm insertWildcard rhs
+    where
+        insertWildcard (TVarE name type') | "undefined" == (TH.nameBase name) =
+            TWildE name type'
+        insertWildcard t = t
hunk ./src/Igor2/Data/Rules.hs 79
--- Replace all occurences of "undefined" by wildcards, each with a different
--- name.
-undefinedToWildcard :: TExp -> RenameStateMonad TExp
-undefinedToWildcard rhs = do
-    rhs' <- renameVars rhs
-    return rhs'
-  where
-    -- Given a variable named undefined, make sure it has a unique name and
-    -- convert it to a wildcard. Leave everything else as-is.
-    renameVars (TVarE name type') | "undefined" == (TH.nameBase name) =
-        do newname <- makeUniqueNameFrom name
-           return $ TWildE newname type'
-    renameVars t = fmap (root t) (mapM renameVars (subterms t))
-    indexName name i = (mkName (show name ++ show i), Just i)
-    -- If possible, return name. If it's already used, append the next free
-    -- index to it. In any case, add the returned name to the State Set of used
-    -- names. Increase the State Int counter if appropriate.
-    makeUniqueNameFrom :: Name -> RenameStateMonad Name
-    makeUniqueNameFrom name = do
-        (usedNames, counter) <- get
-        let newNames = (name, Nothing) : map (indexName name) [counter..]
-        let isUnused name = not (Data.Set.member name usedNames)
-        let (newName, usedCounter) = head $ filter (isUnused . fst) $ newNames
-        put (Data.Set.insert newName usedNames, fromMaybe counter usedCounter)
-        return newName
-
hunk ./src/Syntax/Class/Term.hs 19
-    mapTermM,
+    mapTermM, mapTerm,
hunk ./src/Syntax/Class/Term.hs 135
+mapTerm :: Term t => (t -> t) -> t -> t
+mapTerm f t = f $ root t new_subterms
+    where
+        new_subterms = map (mapTerm f) (subterms t)
+