[Replaced fail with throwError in Syntax.Class.Subst.merge. Also, qualified merge.
tobias@goedderz.info**20150316105235
 Ignore-this: d58767eafe92ae5da16af2f38ae92fd5
 
 This prevents unintended calls to "error" during unification, where an exception
 should be thrown and caught instead.
] hunk ./src/Igor2/RuleDevelopment/Matching.hs 12
-import Syntax
+import Syntax hiding (merge)
+import qualified Syntax.Class.Subst as Subst (merge)
hunk ./src/Igor2/RuleDevelopment/Matching.hs 375
-                               let Just s' = foldM merge nullSubst (s : [ n <~ TWildE n t | TVarE n t <- unaffectedvars])
+                               let Right s' = foldM Subst.merge nullSubst (s : [ n <~ TWildE n t | TVarE n t <- unaffectedvars]) :: Either String (Subst TExp)
hunk ./src/Syntax/Class/Subst.hs 28
+import Control.Monad.Error (Error, MonadError, strMsg, throwError)
+
hunk ./src/Syntax/Class/Subst.hs 60
-merge      :: (Substitutable t, Monad m) => Subst t -> Subst t -> m (Subst t)
-merge s1 s2 = if agree then return $ Subst ((M.union `on` unSubst) s1 s2) else fail "merge fails"
+merge      :: (Substitutable t, Monad m, Error e, MonadError e m) => Subst t -> Subst t -> m (Subst t)
+merge s1 s2 = if agree then return $ Subst ((M.union `on` unSubst) s1 s2)
+                       else throwError $ strMsg "merge fails."
hunk ./src/Syntax/Class/Unifier.hs 30
-import Syntax.Class.Subst
+import Syntax.Class.Subst hiding (merge)
+import qualified Syntax.Class.Subst as Subst
hunk ./src/Syntax/Class/Unifier.hs 50
-    matchL tl sl = mapM (uncurry match) (zip tl sl) >>= foldM merge nullSubst
+    matchL tl sl = mapM (uncurry match) (zip tl sl) >>= foldM Subst.merge nullSubst
hunk ./src/Syntax/UnifyTy.hs 20
-import Syntax.Class
+import Syntax.Class hiding (merge)
+import Syntax.Class.Subst as Subst (merge)
conflictor [
hunk ./src/Syntax/UnifyTy.hs 44
-    match t (VarT n)                 = return $ n <~ t
-    match t (ForallT _ c (VarT n))   = check (n <~ t) c >> return (n <~ t)
-    match t (ForallT _ c (AppT l r)) = match t (AppT (quantify l c)(quantify r c))
-    match (ForallT _ c (AppT l r)) t = match (AppT (quantify l c)(quantify r c)) t
-    match (AppT l r)(AppT l' r')     = do sl <- match l l'
-                                          sr <- match r r'
-                                          merge sl sr
+    match t (VarT n)               = return $ n <~ t
+    match t (ForallT c (VarT n))   = check (n <~ t) c >> return (n <~ t)
+    match t (ForallT c (AppT l r)) = match t (AppT (quantify l c) (quantify r c))
+    match (ForallT c (AppT l r)) t = match (AppT (quantify l c) (quantify r c)) t
+    match (AppT l r) (AppT l' r')  = do sl <- match l l'
+                                        sr <- match r r'
+                                        merge sl sr
]
:
hunk ./src/Syntax/UnifyTy.hs 50
-                                          merge sl sr
+                                          Subst.merge sl sr
