[Bugfixes and code cosmetics
martin.hofmann@uni-bamberg.de**20090514143022
 BUGFIX Antiunifier: modified checkforAntoInstance s.t. no wildcards remain in a rule, but are bound by some pattern
 BUGFIX Hypo rating: count rules was erroneous
 BUGFIX show CallDep is not "" when empty
] hunk ./src/Data/CallDependencies.hs 92
-    pretty = pretty.callings
+    pretty = 
+        (\d -> if (show d) == "" then text "<none>" else d).pretty.callings
hunk ./src/Main.hs 14
---main = startUI
+
hunk ./src/Main.hs 22
- , optBatch       :: Maybe FilePath
+ , optBatch       :: FilePath
hunk ./src/Main.hs 30
- , optBatch       = Nothing
+ , optBatch       = ""
hunk ./src/Main.hs 35
- [ Option ['v']     ["verbose"]
+ [ Option ['v']      ["verbose"]
hunk ./src/Main.hs 38
- , Option ['V'] ["version"]
+ , Option ['V']      ["version"]
hunk ./src/Main.hs 40
-     "Show version number"
+     "Show version number amd exit"
hunk ./src/Main.hs 43
-     "Show Igor commands"
+     "Show Igor commands and exit"
hunk ./src/Main.hs 47
- , Option ['b']     ["batch"]
-     (OptArg ((\ f opts -> opts { optBatch = Just f }) . fromMaybe "batch")
-             "FILE")
+ , Option ['b']      ["batch"]
+     (ReqArg (\ f opts -> opts { optBatch = f }) "FILE")
hunk ./src/Main.hs 64
+    let batch = optBatch opts
hunk ./src/Main.hs 67
-    when (optShowHelp opts) $ putStrLn ("IgorII " ++ UI.version) >>   
-                                        putStrLn usage >>
-                                        UI.showHelp >> return ()
-    when (optShowVersion opts) $ putStrLn ("IgorII " ++ UI.version) >> return ()
-    if (isJust.optBatch $ opts)
-      then do let (Just f) = optBatch opts
-              e <- doesFileExist f
-              if e then UI.runBatch state f
-                else print ("No such file: " ++ (show f)) >> 
+    when (optShowHelp opts) $ 
+        putStrLn ("IgorII " ++ UI.version) >>   
+        putStrLn usage >> UI.showHelp >> 
+        exitWith ExitSuccess
+    when (optShowVersion opts) $ 
+        putStrLn ("IgorII " ++ UI.version) >> exitWith ExitSuccess
+    if (not.null $ batch)
+      then do e <- doesFileExist batch
+              if e then UI.runBatch state batch
+                else print ("No such file: " ++ (show batch)) >> 
hunk ./src/Rating/Rateable.hs 49
-numberOfTotalRules h =  S.size $ S.map lhs (allRules h)
+numberOfTotalRules =  S.size.allRules 
hunk ./src/Syntax/Antiunifier.hs 21
-import Data.List (transpose)
+import Data.List (transpose, find)
hunk ./src/Syntax/Antiunifier.hs 271
-checkforAntiInstance l@(x:xs) =    
-    if and $ map (== x) xs
-       then return x
+checkforAntiInstance l@(x:xs) =  
+    if (all (== x) xs) && not (any isWild xs || all isVar xs)
+    -- all terms are equal, but they are not all variables or one is a wildcard
+       then return x 
hunk ./src/Syntax/Antiunifier.hs 276
+       -- If all terms are wildcards or variables, they are anti-unified 
+       -- nevertheless. This is necessary to bind wildcards by a variable in the
+       -- pattern, so also images with the same variable must occur in the 
+       -- table. Thus variables are renamed. 
+       -- Even, iff all are wildcards, there should never be a new and unbound 
+       -- variable introduced for them, because there should always be some 
+       -- pattern which binds the wildcard. Hopefully! 
hunk ./src/Syntax/Antiunifier.hs 313
-updateVarTable table img =
+updateVarTable table img = 
hunk ./src/Syntax/Antiunifier.hs 315
+    -- This is a hack!! Damn! Wildcards equal everything, this messes up the 
+    -- retrieval! So I loock p in the list, which is search linear.
hunk ./src/Syntax/Expressions.hs 119
-        braces $ pretty (VarE (mkName ('?':(show n)))) <+> colon <> colon <+> pretty t
+        braces $ red $ pretty (VarE (mkName ('?':(show n)))) <+> colon <> colon <+> pretty t
hunk ./src/Syntax/Expressions.hs 207
+     
+    isWild (TWildE _ _ ) = True
+    isWild _             = False
hunk ./src/Syntax/Terms.hs 136
+    isWild :: t -> Bool
+      
hunk ./src/SynthesisEngine.hs 97
-             text "Candidate Hyposs:" <^> pretty candidatehypos <$>  
+             text "Candidate Hypos:" <^> pretty candidatehypos <$>  
hunk ./src/SynthesisEngine.hs 145
-             text "different sucessor hypotheses."
+             text "different successor hypotheses."
hunk ./src/UI/UIStarter.hs 67
-    , verbose   = True
+    , verbose   = False
hunk ./src/UI/UIStarter.hs 104
-    eval state (unwords cmd) >> return ()
+    eval state (unwords cmd) >>= exit.snd
hunk ./src/UI/UIStarter.hs 118
-    return ()  
+    --exitWith ExitSuccess
+    -- causes an exception when run in ghci  
hunk ./src/UI/UIStarter.hs 342
-    [ ( ":help",                         "Show this help.",          return (Help False))
-    , (":verboseHelp",                  "Show verbose help.",          return (Help True))
-    , (":batch \"path/to/file\"",       "Run a batch file",             pString Batch)
-    , (":load \"path/to/file\"",        "Load a spec file into context.",             pString Load)
-    , (":reset",                        "Reset the current context.",   return Reset)
-    , (":set <option>",                 "Set options.",                  pSet)
-    , (":generalise \"tgts\" [with \"bgks\"]",                 "Start generalisation.",                  pStart)
-    , (":test i \"tgts\" [with \"bgks\"] on \"command\"",      "Test a generalised program.",            pTest)
-    , (":info",                         "Show current settings.",       return Info)
-    , (":yell \"something\"",           "Yell on command line.",        pString Yell)
-    , (":quit",                         "Quit program.",                return Quit)
---  ,("",                    "",                             return Noop)
+    [ (":help",
+            "Show this help.",                return (Help False))
+    , (":verboseHelp",
+            "Show verbose help.",             return (Help True))
+    , (":batch <path/to/file>",
+            "Run a batch file",               pString Batch)
+    , (":load <path/to/file>",
+            "Load a spec file into context.", pString Load)
+    , (":reset",
+            "Reset the current context.",     return Reset)
+    , (":set <option>",
+            "Set options.",                   pSet)
+    , (":generalise <tgts> [with <bgks>]",
+            "Start generalisation.",          pStart)
+    , (":test <i> <tgts> [with <bgks>] on \"command\"",
+            "Test a generalised program.",    pTest)
+    , (":info",
+            "Show current settings.",         return Info)
+    , (":yell \"something\"",
+            "Yell on command line.",          pString Yell)
+    , (":quit",
+            "Quit program.",                  return Quit)
hunk ./src/UI/UIStarter.hs 372
-    hang 35 $ (fill 35 (text cmd)) <> fillSep (map text (words help))
+    hang 45 $ (fill 45 (text cmd)) <> fillSep (map text (words help))
hunk ./src/UI/UIStarter.hs 376
-    [ ("debug",             "debug mode",                   debug,   \ v s -> s { debug  = v })
-    , ("verbose",           "be verbose",                   verbose, \ v s -> s { verbose  = v })
-    , ("dumpLog",           "dump log to file",             dumpLog, \ v s -> s { dumpLog  = v })
+    [ ("debug",             "debug mode",
+            debug,   \ v s -> s { debug  = v })
+    , ("verbose",           "be verbose",
+            verbose, \ v s -> s { verbose  = v })
+    , ("dumpLog",           "dump log to file",
+            dumpLog, \ v s -> s { dumpLog  = v })
hunk ./src/UI/UIStarter.hs 386
-    [ ("maxHypos",          "maximal number of hypotheses",  maxHypos,  \ v s -> s { maxHypos = v})
-    , ("colWidth",          "set the column width of your display",  colWidth,  \ v s -> s { colWidth = v})
+    [ ("maxHypos",          "maximal number of hypotheses",
+            maxHypos,  \ v s -> s { maxHypos = v})
+    , ("colWidth",          "set the column width of your display",
+            colWidth,  \ v s -> s { colWidth = v})
hunk ./src/UI/UIStarter.hs 394
-    [ ("dumpDir",          "directory of log files",  dumpDir,  \ v s -> s { dumpDir = v})
+    [ ("dumpDir",          "directory of log files",
+            dumpDir,  \ v s -> s { dumpDir = v})
hunk ./src/UI/UIStarter.hs 431
-         , identLetter    = alphaNum <|> oneOf "_'."
+         , identLetter    = alphaNum <|> oneOf "_'./"
hunk ./src/UI/UIStarter.hs 484
-   <?> "[+|-]<flag>"             
+   <?> ":set s[+|-]<flag>"             
hunk ./src/UI/UIStarter.hs 492
-   <?> "<option>=<value>"
+   <?> ":set <option>=<value>"
hunk ./src/UI/UIStarter.hs 500
-   <?> "<option>=<value>"
+   <?> ":set <option>=<value>"
hunk ./src/UI/UIStarter.hs 512
-     <?> " \"t1 t2 ...\" [with \"b1 b2 ...\"]"
+     <?> ":generalise <t1 t2 ...> [with <b1 b2 ...>]"
hunk ./src/UI/UIStarter.hs 522
-     <?> " <hypoNo> \"t1 t2 ...\" [with \"b1 b2 ...\"] on \" expression \""            
+     <?> ":test <i> <t1 t2 ...> [with <b1 b2 ...>] on \"expression\""            