[let AUnify TExp handle wildcards
Helmut Grohne <grohne@cs.uni-bonn.de>**20150217143627
 Ignore-this: 190a64a20dab0ac5886e9b152b43d7f4
 
 This fixes a serious bug in igor. The direct call rule development assumed that
 a variable in a lgg returned from AUnify would not be unifiable on the IO
 examples. Consider the following RHS:
 
  ?p (a wildcard)
  S p
  S p
 
 The antiunifier would return a fresh variable, because one TExp contains a
 wildcard. However the unifier could still unify these TExps. Thus the direct
 call could pick any of these RHS (for example the wildcard), generate a call
 (which works) since the chosen RHS matches with all RHS, insert the call even
 though it could violate an IO Example.
 
 The solution is to handle wildcards in the antiunifier as well. As a
 consequence wildcards can now occur in closed rules and thus final hypotheses.
 Another consequence is that a better (less partitions) solution is found for
 the pepper example.
] 
<
[simplify isTuple and isAnyTuple without TemplateHaskell
Helmut Grohne <grohne@cs.uni-bonn.de>**20140717084230
 Ignore-this: 3bb9e59d15a53053c78df69001431229
] 
[simplify the data type Type
Helmut Grohne <grohne@cs.uni-bonn.de>**20150209153158
 Ignore-this: 7e09228772a1b15bc375449fc28502cf
 
 Remove constructors ArrowT, ListT and TupleT. These can also be represented as
 compositions of AppT and ConT. Re-define their lower-case constructors suitably
 and improve pretty-printing to cover for these cases.
] 
[improve pretty printing of wildcards
Helmut Grohne <grohne@cs.uni-bonn.de>**20150217143213
 Ignore-this: e0aa9284e9302ebdeaead04bfd53e064
 
 The current way of transforming TWildEs into TH.Exp, is not valid Haskell as an
 unbound identifier prefixed with a question mark is used. If a wildcard shows
 up in a final hypothesis, it cannot be compiled. Thus changing the
 representation of wildcards to calls of error with the wildcard name attached.
 
 While this is not relevant here, it becomes relevant once igor can create
 hypotheses containing wildcards.
] 
> hunk ./src/Syntax/UnifyExp.hs 9
-import Data.List (transpose)
+import Data.List (transpose, find)
hunk ./src/Syntax/UnifyExp.hs 60
-instance AUnify TExp where        
+isWild TWildE {} = True
+isWild _         = False
+
+instance AUnify TExp where
hunk ./src/Syntax/UnifyExp.hs 65
+    aunify t | all isWild t = return (head t)
hunk ./src/Syntax/UnifyExp.hs 67
-        | checkAU t = let l = (map subterms t) in
-                        if [] `elem` l then return . head $ t
-                         else mapM aunify (transpose l) >>= return . (roots t) 
+        | checkAU t   = let nonWilds = filter (not . isWild) t
+                            wildSubterms = map (tWildE "x" . typeOf) . subterms $ head nonWilds
+                            l = [ if isWild e then wildSubterms else subterms e | e <- t ]
+                        in if [] `elem` l then return (head nonWilds)
+                           else liftM (roots nonWilds) $ mapM aunify (transpose l)
hunk ./src/Syntax/UnifyExp.hs 74
-checkAU l = (sameRoots l) && not (any isWild l || all isVar l)
-    where
-    isWild (TWildE _ _) = True
-    isWild _            = False
-   
+checkAU l = let l' = filter (not . isWild) l
+            in sameRoots l' && not (all isVar l')
+
hunk ./src/Syntax/UnifyExp.hs 78
-bindVarAU img =  getMap >>= maybe (mkVar img) return . lookup img
-     
+bindVarAU img = getMap >>= maybe (mkVar img) return . liftM snd . find matchimg
+  where matchimg (img', _) = and $ zipWith ok img img'
+        ok TWildE{} _ = True
+        ok x        y = x == y
+
hunk ./tests/pepper.out 28
-             pepper       in 28     loops
+             pepper       in 25     loops
hunk ./tests/pepper.out 37
-fun2 a0 (a1 : a2) = fun7 a0 (a1 : a2) : fun2 (fun28 a0 (a1 : a2)) a2
-fun28 a0 [_] = a0
-fun28 a0 (_ : (_ : _)) = S a0
+fun2 a0 (a1 : a2) = fun7 a0 (a1 : a2) : fun2 (S a0) a2