[prettier printing, code cosmetics
martin.hofmann@uni-bamberg.de**20090218092833] hunk ./src/Data/CallDependencies.hs 20
+
hunk ./src/Data/CallDependencies.hs 23
+import Data.List (delete)
hunk ./src/Data/CallDependencies.hs 60
-     deriving (Show)
+     
hunk ./src/Data/CallDependencies.hs 65
-        
+instance Show Calls where
+    show = show.unC
+instance Pretty Calls where
+    pretty = align . vcat. (map text) . (delete []) . lines .show
+                         
hunk ./src/Data/CallDependencies.hs 77
-	pretty = text.show
+    pretty = pretty.callings
hunk ./src/Data/HypoSpace.hs 5
-    insert, delete, -- should not be visible outside 
hunk ./src/Data/HypoSpace.hs 45
+
+type ID = Int
+type IDs = IS.IntSet
hunk ./src/Data/HypoSpace.hs 61
-type ID = Int
-type IDs = IS.IntSet
+    
+-- | /O(1)/, create an empty Search Space
+emptyHSpace :: HSpace
+emptyHSpace = HSpace 
+    { hypoCounter   = 0
+    , rateIdsMap  = M.empty -- I.empty
+    , ruleIdsMap  = M.empty
+    , hypoIdBimap = B.empty
+    }
+ 
+-- | /O(1)/, initialise a search space with a 'RuleFrag' as inital hypothese
+initHSpace :: RuleFrag ->  HSpace
+initHSpace rf = insert initHypo emptyHSpace
+    where
+    initHypo = hypo [rf]
hunk ./src/Data/HypoSpace.hs 80
+-- | /O(m log n)/ where m is the number of affected hypotheses and n the number 
+--   of total rules
+-- Propagate a Rule modification over the whole search space
+propagateHSp :: RuleFrag -> [(RuleFrags,[Call])] -> HSpace -> HSpace
+propagateHSp ro advs hsp = 
+        foldl' replaceByDeveloped hsp affectedHs
+    where
+    replaceByDeveloped = (\sp h -> replace h (develop h) sp)
+    develop h = catMaybes $ [ developH ro adv h | adv <- advs]
+    affectedHs =
+            case M.lookup ro (ruleIdsMap hsp) of
+                    Just ids -> mapMaybe (flip getById hsp) (IS.toList ids)
+                    Nothing -> []
+
+-- | /O(log n)/ find the best valued Hypotheses
+bestHypos :: HSpace -> Hypos
+bestHypos  =  hypos.((IS.toList . snd . M.findMin . rateIdsMap) >>= getByIds)
+            --hypos.((IS.toList .  I.findMin . rateIdsMap) >>= getByIds)
+
+
+--------------------------------------------------------------------------------
+-- Internal functions
+--------------------------------------------------------------------------------
hunk ./src/Data/HypoSpace.hs 160
-    
--- | /O(1)/, create an empty Search Space
-emptyHSpace :: HSpace
-emptyHSpace = HSpace 
-    { hypoCounter   = 0
-    , rateIdsMap  = M.empty -- I.empty
-    , ruleIdsMap  = M.empty
-    , hypoIdBimap = B.empty
-    }
- 
--- | /O(1)/, initialise a search space with a 'RuleFrag' as inital hypothese
-initHSpace :: RuleFrag ->  HSpace
-initHSpace rf = insert initHypo emptyHSpace
-    where
-    initHypo = hypo [rf]
hunk ./src/Data/HypoSpace.hs 203
--- | /O(m log n)/ where m is the number of affected hypotheses and n the number 
---   of total rules
--- Propagate a Rule modification over the whole search space
-propagateHSp :: RuleFrag -> [(RuleFrags,[Call])] -> HSpace -> HSpace
-propagateHSp ro advs hsp = 
-        foldl' replaceByDeveloped hsp affectedHs
-    where
-    replaceByDeveloped = (\sp h -> replace h (develop h) sp)
-    develop h = catMaybes $ [ developH ro adv h | adv <- advs]
-    affectedHs =
-            case M.lookup ro (ruleIdsMap hsp) of
-                    Just ids -> mapMaybe (flip getById hsp) (IS.toList ids)
-                    Nothing -> []
-
--- | /O(log n)/ find the best valued Hypotheses
-bestHypos :: HSpace -> Hypos
-bestHypos  =  hypos.((IS.toList . snd . M.findMin . rateIdsMap) >>= getByIds)
-            --hypos.((IS.toList .  I.findMin . rateIdsMap) >>= getByIds)
hunk ./src/Data/HypoSpace.hs 213
-        pretty hsp = text "HSpace" <$> 
+        pretty hsp = text "HSPACE" <$> 
hunk ./src/Data/HypoSpace.hs 215
-                        text "Rating -> HypoID:" <$> pretty (rateIdsMap hsp) <$> 
-                        text "Rating -> HypoID:" <$> pretty (ruleIdsMap hsp) <$> 
+                        text "Rating -> HypoID:" <^> pretty (rateIdsMap hsp) <$> 
+                        text "Rule   -> HypoID:" <^> pretty (ruleIdsMap hsp) <$> 
hunk ./src/Data/Initialiser.hs 27
+import Logging
hunk ./src/Data/Initialiser.hs 39
-dec2rules (FunD n cs) = (n,clauses2rules cs) 
+dec2rules (FunD n cs) =  (n,clauses2rules cs) 
hunk ./src/Data/Initialiser.hs 49
-clauses2rules cs = rules $ map clause2rules cs
+clauses2rules cs =  rules $ map clause2rules cs
hunk ./src/ExampleDefs.hs 1005
-             rev [x,y,z] = [z,x,y]
+             rev [x,y,z] = [z,y,x]
+             rev [w,x,y,z] = [z,y,x,w]
hunk ./src/ExampleDefs.hs 1015
+
+lastdef = [d| lst [w] = w
+              lst [x,w] = w 
+              lst [y,x,w] = w
+              lst [z,y,x,w] = w
+           |]
+
+revinitdef = [d| rinit [w] = []
+                 rinit [x,w] = [x] 
+                 rinit [y,x,w] = [x,y]
+                 rinit [z,y,x,w] = [x,y,z]
+             |]
hunk ./src/ExampleDefs.hs 1033
-                 rev [x,y,z] = [z,x,y]
+                 rev [x,y,z] = [z,y,x]
hunk ./src/Logging/Logger.hs 169
-                     
+
+-- | Strips away the monadic ErrorLogging context. This is unsafe, because if
+--   an error occurred in the Monad it is propagated.       
+-- TODO: Should rather be something with `catchError`                
hunk ./src/Logging/Logger.hs 174
-unLM m =   
+unLM m =  
hunk ./src/Logging/PrettyPrinter.hs 13
+import qualified Data.Bimap as B
hunk ./src/Logging/PrettyPrinter.hs 51
-printLog logs handles = return () -- mapM_ (flip hPutDoc content) handles
+printLog logs handles =  mapM_ (flip hPutDoc content) handles
hunk ./src/Logging/PrettyPrinter.hs 57
-    docs <- liftM vcat $ mapM printInQ (zip decs [1..])
+    let hyponum = length decs
+    docs <- liftM vcat $ mapM (printInQ  hyponum) (zip decs [1..])
hunk ./src/Logging/PrettyPrinter.hs 62
-printInQ :: ([Dec],Int) -> IO Doc    
-printInQ = \(d,i) -> (runQ.return) d >>= \p -> 
-                return $ indent 6 (text "HYPOTHESE" <+> int i <> colon) <$$>
+printInQ :: Int -> ([Dec],Int) -> IO Doc    
+printInQ = \j (d,i) -> (runQ.return) d >>= \p -> 
+                return $ indent 6 (text "HYPOTHESE" <+> int i <+> text "of" <+> int j<> colon) <$$>
hunk ./src/Logging/PrettyPrinter.hs 109
-    pretty = text.show
+    pretty = text.pprint
hunk ./src/Logging/PrettyPrinter.hs 122
+    
+instance (Pretty a, Pretty b) => Pretty (B.Bimap a b) where
+    pretty b = list $ map asMap (B.toAscList b) 
hunk ./src/Main.hs 311
-igortest = startSynthesis revdef [d||]
+igortest = startSynthesis revdef $ liftM concat $ sequence  [revinitdef, lastdef]
hunk ./src/Main.hs 313
+ 
+ 