[Added a TExp pair generator for match.
tobias@goedderz.info**20150327154722
 Ignore-this: 7d9ef689a9f6a36cbe5fd754740c12f9
 
 Both values are derived from the same TExp, but the left one is more special
 (i.e., some nodes are replaced with wildcards) and the right one is more general
 (i.e., some nodes are replaced with variables).
] hunk ./src/Tests.hs 22
-    (°), apply, arrowCon, boolCon, ctx_types, defaultContext, eitherCon, equal,
-    getVarNames, intCon, isFunT, lgg, listCon, match, maybeCon, safeCatchErrorC,
-    size, substitute, subtermAt, subterms, tAppE, tupleCon, typeOf, unArrowT,
-    unfoldTAppE)
+    (°), apply, applyAtPos, arrowCon, boolCon, ctx_types, defaultContext,
+    eitherCon, equal, getVarNames, intCon, isFunT, lgg, listCon, match,
+    maybeCon, safeCatchErrorC, size, substitute, subtermAt, subterms, tAppE,
+    tupleCon, typeOf, unArrowT, unfoldTAppE)
hunk ./src/Tests.hs 85
+newtype MatchingTExps = MatchingTExps { getMatchingTExps :: (TExp, TExp) }
+    deriving Show
+
+instance QC.Arbitrary MatchingTExps where
+    arbitrary = do
+        baseTExp <- QC.arbitrary
+        numVarSubsts <- chooseLog (size baseTExp)
+        numWildSubsts <- chooseLog (size baseTExp)
+        varPoss <- liftM (take numVarSubsts) $ nonOverlappingPos baseTExp
+        wildPoss <- liftM (take numWildSubsts) $ nonOverlappingPos baseTExp
+        let varSubTerms = map (fromJust . subtermAt baseTExp) varPoss
+        let wildSubTerms = map (fromJust . subtermAt baseTExp) wildPoss
+        let takenNames = S.fromList (getVarNames baseTExp)
+        let varPrefix = "mtevar"
+        let freeNames = St.evalState (freeNamesM varPrefix) (takenNames, 1)
+        let names = St.evalState (mapM assignName varSubTerms) (M.empty, freeNames)
+        let vars = map TVarE names
+        let varSubstTExp = foldl (\term (subst, pos) -> applyAtPos (subst . typeOf) pos term) baseTExp (zip vars varPoss)
+        let wildSubst = TWildE (mkName "_")
+        let wildSubstTExp = foldl (\term pos -> applyAtPos (wildSubst . typeOf) pos term) baseTExp wildPoss
+        return $ MatchingTExps (wildSubstTExp, varSubstTExp)
+
hunk ./src/Tests.hs 247
-    testProperty "MatchingTypes: apply (match a b) b == a" (uncurry (matchApplyUnforgiving typeWitness) . getMatchingTypes)
+    testProperty "MatchingTypes: apply (match a b) b == a" (uncurry (matchApplyUnforgiving typeWitness) . getMatchingTypes),
+    testProperty "MatchingTExps: apply (match a b) b == a" (uncurry (matchApplyUnforgiving texpWitness) . getMatchingTExps)