[Added Error handling to LM, BUGFIX Unifier.hs
martin.hofmann@uni-bamberg.de**20090126141813
 Unifier.hs :
 	- BUGFIX: error handling for function 'matches' needed to distinguish between identity and match-failure
] hunk ./src/Data/IOData.hs 171
-    rule         = noLog $ antiunifyRules rules
+    rule         = unLM $ antiunifyRules rules
hunk ./src/Logging/Logger.hs 5
-    runELT,  runEL, noLog,
+    runELT,  runLM, unLM,
hunk ./src/Logging/Logger.hs 41
+import Control.Monad.Error
hunk ./src/Logging/Logger.hs 163
-noLog :: LM a -> a 
-noLog = fst.runEL 
+unLM :: LM a -> a 
+unLM m = 
+    case fst (runLM m) of 
+        Left s  -> error s
+        Right a -> a
hunk ./src/Logging/Logger.hs 173
-type ELT m = (StateT LogState (WriterT Log m))
+
+type ELT m = (StateT LogState (ErrorT String (WriterT Log m)))
hunk ./src/Logging/Logger.hs 176
-runELT :: (Monad m) => (ELT m a) -> m (a, Log)
-runELT =  \m -> (runWriterT (evalStateT m (DEBUG,"","")))             
+runELT :: (Monad m) => (ELT m a) -> m (Either String a, Log) 
+runELT =  \m -> (runWriterT (runErrorT (evalStateT m (DEBUG,"",""))))             
hunk ./src/Logging/Logger.hs 180
-runEL = runIdentity.runELT
+runLM = runIdentity.runELT
hunk ./src/Logging/Logger.hs 199
-printResult :: ([[Dec]],Log) -> IO()
-printResult (d,l) = do 
+printResult :: (Either String [[Dec]],Log) -> IO()
+printResult (r,l) = do 
hunk ./src/Logging/Logger.hs 204
-    printDecs d [fhandle,stdout]
+    case r of
+        Left  e -> mapM_ ((flip hPutStr)  ("UNCAUGHT ERROR: " ++ e)) [fhandle,stdout]
+        Right r -> printDecs r [fhandle,stdout]
hunk ./src/Logging/Logger.hs 211
-printLog logs handles = mapM_ (flip hPutDoc content) handles
+printLog logs handles = return () -- mapM_ (flip hPutDoc content) handles
hunk ./src/SynthesisEngine.hs 18
+import Control.Monad.Error
hunk ./src/SynthesisEngine.hs 21
-
hunk ./src/SynthesisEngine.hs 32
-       runIO $ printResult $ runEL  (synthesise tgt bgk)
+       runIO $ printResult $ (runLM  (synthesise tgt bgk)) 
hunk ./src/SynthesisEngine.hs 37
-    setPriority INFO
hunk ./src/SynthesisEngine.hs 42
-    result <- runIM ( synthesiseTargets tnms) igordata 
+    result <- (runIM ( synthesiseTargets tnms) igordata) 
hunk ./src/SynthesisEngine.hs 52
-    llogNO $ text "STARTING SYNTHESIS for TARGET" <+> squotes (pretty n)
+    llogIN $ text "STARTING SYNTHESIS for TARGET" <+> squotes (pretty n)
hunk ./src/SynthesisEngine.hs 60
-    loopCount >>= \lc -> llogNO $ text "Entering Rule-Advancement-Loop for the" <+> int lc <+> text ". time"
+    loopCount >>= \lc -> llogIN $ text "Entering Rule-Advancement-Loop for the" <+> int lc <+> text ". time"
hunk ./src/SynthesisEngine.hs 62
-    hypoCount >>= \hc -> llogNO $ text "Currently are" <+> int hc <+> text "hypotheses in the search space"
+    hypoCount >>= \hc -> llogIN $ text "Currently are" <+> int hc <+> text "hypotheses in the search space"
hunk ./src/Terms/Unifier.hs 13
+import Control.Monad.Error
hunk ./src/Terms/Unifier.hs 65
-    matches t1 t2 = liftM (not.null) (matchesWithSubs t1 t2)
+    matches t1 t2 = liftM (not.null) $ 
+                    (matchesWithSubs t1 t2) `catchError` (\_ -> return [])