[doc and code cleaning
martin.hofmann@uni-bamberg.de**20100315100628] hunk ./src/Igor2/Data/HypoSpace.hs 80
---{- -----------------------------------------------------------------------------
+{- ---------------------------------------------------------------------------
hunk ./src/Igor2/Data/HypoSpace.hs 82
-------------------------------------------------------------------------------- -}
+----------------------------------------------------------------------------- -}
hunk ./src/Igor2/Data/Hypotheses.hs 192
-         numPartitions   <- numberOfPartitions h
-         numClosedPartitions <- numberOfClosedPartitions h
-         heu <- heuristic h
-         let numOpenRules   = numberOfOpenRules h
-         let numFreeVars    = numberOfFreeVars h
-         let numTotalRules   = numberOfTotalRules h
-         let numNonConstBinds = numberOfNonConstBinds h  -- better than numTotalRules !!!
-         let numCycles = cycles . callings $ h         
-         let numFVarPerRule  = if (numOpenRules == 0) then 0.0 else on (/) fromIntegral numFreeVars numOpenRules
-         return ( mkRatingData
-                 --numPartitions + numCycles + numOpenRules,
-                  numPartitions
-                 -- numCycles,
-                  numOpenRules
-                  numFreeVars
---                  numNonConstBinds
-                  numTotalRules
-                  heu
-                  -- numFVarPerRule
-                )
+      numPartitions <- numberOfPartitions h
+      numClosedPartitions <- numberOfClosedPartitions h
+      heu <- heuristic h
+      let numOpenRules = numberOfOpenRules h
+      let numFreeVars = numberOfFreeVars h
+      let numTotalRules = numberOfTotalRules h  
+      -- better than numTotalRules !!!
+      let numNonConstBinds = numberOfNonConstBinds h
+      let numCycles = cycles . callings $ h         
+      let numFVarPerRule  = 
+            if (numOpenRules == 0) then 0.0 
+              else on (/) fromIntegral numFreeVars numOpenRules
+      return ( mkRatingData
+               --numPartitions + numCycles + numOpenRules,
+               numPartitions
+               -- numCycles,
+               numOpenRules
+               numFreeVars
+               -- numNonConstBinds
+               numTotalRules
+               heu
+               -- numFVarPerRule
+             )
hunk ./src/Igor2/Data/Hypotheses.hs 239
--- number of Pattern the do not subsume any other pattern          
+-- number of Pattern that do not subsume any other pattern          
hunk ./src/Igor2/Data/Hypotheses.hs 241
-numberOfLeastPatterns rs = liftM length $ (foldM leastPatterns []) ((filter (not . hasHO)) . S.toList $ rs)
-    where
-    leastPatterns [] p = return [p]
-    leastPatterns (p1:ps) p2 = do
-        b1 <- matchLhss p1 p2
-        b2 <- matchLhss p2 p1
-        if b1 then return (p1:ps)
-         else if b2 then return (p2:ps)
-          else liftM (p1:) (leastPatterns ps p2)
+numberOfLeastPatterns rs = 
+  liftM length $ (foldM leastPatterns []) ((filter (not . hasHO)) . S.toList $ rs)
+      where
+        leastPatterns [] p = return [p]
+        leastPatterns (p1:ps) p2 = do
+          b1 <- matchLhss p1 p2
+          b2 <- matchLhss p2 p1
+               if b1 then return (p1:ps)
+               else if b2 then return (p2:ps)
+                    else liftM (p1:) (leastPatterns ps p2)
hunk ./src/Igor2/Data/Hypotheses.hs 252
-
+-- a one-number heuristic, currently only used for coloring a node in the search
+-- tree when visualised with istviewer.
+heuristic :: (MonadPlus m, MonadError e m) => Hypo -> C m ([Float], Float)        
hunk ./src/Igor2/Data/IgorMonad.hs 10
-    --Context
+    -- Context
hunk ./src/Igor2/Data/IgorMonad.hs 14
-    setTarget, getTarget, addBgk, remBgk, getEvidence, 
-    tick, nextTier, loopCount, loopsCount, tierCount, isDebug, 
-    inEnhanced, ifIsSet, atMaxLoops, atMaxTiers, getPatComparison, background, targets, 
-    predicates, addIO, breakupM, coverAll, evalIO,
+    setTarget, getTarget, addBgk, remBgk, getEvidence, tick, nextTier, 
+    loopCount, loopsCount, tierCount, isDebug, inEnhanced, ifIsSet, atMaxLoops, 
+    atMaxTiers, getPatComparison, background, targets, predicates, addIO, 
+    breakupM, coverAll, evalIO,
hunk ./src/Igor2/Data/IgorMonad.hs 23
-
hunk ./src/Igor2/Data/IgorMonad.hs 44
+-- | a record encapsulating all necessary data for synthesis
hunk ./src/Igor2/Data/IgorMonad.hs 53
-
-
hunk ./src/Igor2/Data/IgorMonad.hs 57
+-- | evaluate an 'Igor' 'StateT' 'IM'
hunk ./src/Igor2/Data/IgorMonad.hs 64
+
hunk ./src/Igor2/Data/IgorMonad.hs 99
--- Monadic operations on 'Config'
+-- Monadic operations on 'Config', inspecting the current settings
hunk ./src/Igor2/Data/IgorMonad.hs 101
+
+-- | are we debugging?
hunk ./src/Igor2/Data/IgorMonad.hs 106
+-- | are we in enhanced mode?
hunk ./src/Igor2/Data/IgorMonad.hs 110
+-- | monadic if_then_else
hunk ./src/Igor2/Data/IgorMonad.hs 116
+-- | a threshold for a maximum number of loops, i.e. algorithm cycles
hunk ./src/Igor2/Data/IgorMonad.hs 120
+-- | have we reached the maximum loop theshold
hunk ./src/Igor2/Data/IgorMonad.hs 124
+-- | how do we compare recursive arguments
hunk ./src/Igor2/Data/IgorMonad.hs 128
+-- | get the comparison function according to how we compare recursive arguments
hunk ./src/Igor2/Data/IgorMonad.hs 136
+-- | what predicates are we using for conditional rules
+--   NOT IMPLEMENTED YET        
hunk ./src/Igor2/Data/IgorMonad.hs 141
+-- | the given target functions
hunk ./src/Igor2/Data/IgorMonad.hs 145
+-- | the backgrou nd functions
hunk ./src/Igor2/Data/IgorMonad.hs 149
+-- | modify the StateT and add a name of a backgroubd function
hunk ./src/Igor2/Data/IgorMonad.hs 156
+-- | modify the StateT and remove a name of a backgroubd function
hunk ./src/Igor2/Data/IgorMonad.hs 163
+-- | what is our context file, i.e. the specification given
hunk ./src/Igor2/Data/IgorMonad.hs 188
+
+-- | get all evidence data
hunk ./src/Igor2/Data/IgorMonad.hs 193
-modifyIO ::(IOData -> IOData) -> IM()
+-- | apply a function to the evidence data in 'IM'
+modifyIO ::(IOData -> IOData) -> IM ()
hunk ./src/Igor2/Data/IgorMonad.hs 199
+-- | increase the loop count by 1
hunk ./src/Igor2/Data/IgorMonad.hs 204
+-- | increase the tier count by one
hunk ./src/Igor2/Data/IgorMonad.hs 210
+-- | get the tier count
hunk ./src/Igor2/Data/IgorMonad.hs 214
+-- | threshold for maximum number of tiers            
hunk ./src/Igor2/Data/IgorMonad.hs 218
+-- | have we reached the maximu  tier threshold?
hunk ./src/Igor2/Data/IgorMonad.hs 222
+-- | get the loop count of current target function
hunk ./src/Igor2/Data/IgorMonad.hs 226
+-- | get the loop count of all synthesised target functions so far            
hunk ./src/Igor2/Data/IgorMonad.hs 233
+-- | add the rules 'rs' as IO examples to 'IM', the name under wich they are 
+--   stored is returned.
hunk ./src/Igor2/Data/IgorMonad.hs 242
+-- | a monadic helper to get all covered IO examples from a 'CovrRule'
hunk ./src/Igor2/Data/IgorMonad.hs 249
+-- | returns a 'CovrRule' covering all examples with 'Name' 'n'
hunk ./src/Igor2/Data/IgorMonad.hs 252
+
hunk ./src/Igor2/Data/IgorMonad.hs 256
+-- | evaluate function 'n' with arguments 'args' using the IO examples in 
+--   context
hunk ./src/Igor2/Data/IgorMonad.hs 259
-evalIO n e = do
+evalIO n args = do
hunk ./src/Igor2/Data/IgorMonad.hs 261
-    r   <- (applyC $ matchEvals e $ map crul ios) :: (IM (Either String RHS))
+    r   <- (applyC $ matchEvals args $ map crul ios) :: (IM (Either String RHS))
hunk ./src/Igor2/Data/IgorMonad.hs 264
+-- | resolve an monadic context function, by applying the context given in the 
+--   Igor Monad.
hunk ./src/Igor2/Data/IgorMonad.hs 269
-
--- may fail
+-- | get the names of constructors by name of a type (may fail)
hunk ./src/Igor2/SynthesisEngine.hs 29
-import Igor2.Logging
+import Igor2.Logging hiding (lift4)
hunk ./src/Igor2/SynthesisEngine.hs 47
-    logstate = mkLogState (scr_verbosity conf) (scr_verbose conf) (scr_dumpLog conf)
+    logstate = 
+        mkLogState (scr_verbosity conf) (scr_verbose conf) (scr_dumpLog conf)
hunk ./src/Igor2/SynthesisEngine.hs 51
-synthesise :: Context -> SCR -> [(Name,Rules)] -> [(Name,Rules)] -> LM ([(Name,Int)],[[[FunBind]]])
+synthesise :: Context -> SCR -> [(Name,Rules)] -> [(Name,Rules)]
+           -> LM ([(Name,Int)],[[[FunBind]]])
hunk ./src/Igor2/SynthesisEngine.hs 59
-    logDE ( linebreak <> text "IGOR initialised to:" <$> indent 2 (pretty igordata))
+    logDE ( linebreak <> text "IGOR initialised to:" <$> 
+            indent 2 (pretty igordata))
hunk ./src/Igor2/SynthesisEngine.hs 71
-    simplify True hs  = lift . lift . lift $ mapM (\h -> mapM simplifiedBindings h >>= return . (map snd) >>= return . concat) hs
+    simplify True hs  = lift . lift . lift $ 
+                        mapM (\h -> mapM simplifiedBindings h >>= 
+                                   return . (map snd) >>= return . concat) hs
hunk ./src/Igor2/SynthesisEngine.hs 79
-    outputraw hs = lputDoc  $ linebreak <> text "### BEGIN RAW DATA ###" <$> 
-                              text "I/O TGT" <$> (text . show $ tgts) <$>
-                              text "I/O BGK" <$> (text . show $ bgks) <$> 
-                              text "RESULTS" <$> (text . show $ map reverse hs) <$>
-                              text "### END RAW DATA ###" <> linebreak
+    outputraw hs = 
+      lputDoc $ linebreak <> 
+                text "### BEGIN RAW DATA ###" <$> 
+                text "I/O TGT" <$> (text . show $ tgts) <$>
+                text "I/O BGK" <$> (text . show $ bgks) <$> 
+                text "RESULTS" <$> (text . show $ map reverse hs) <$>
+                text "### END RAW DATA ###" <> linebreak
hunk ./src/Igor2/SynthesisEngine.hs 88
-synthesiseTargets ns = liftM ((map oneFromEach).transpose) $ mapM synthesiseTarget ns
+synthesiseTargets ns = 
+  liftM ((map oneFromEach).transpose) $ mapM synthesiseTarget ns
hunk ./src/Igor2/SynthesisEngine.hs 107
-    loopCount >>= \lc -> waypointM $ text "Entering Rule-Advancement-Loop for the" <+> 
-                                  int (lc) <> text ". time"
+    loopCount >>= \lc -> waypointM $ 
+                        text "Entering Rule-Advancement-Loop for the" <+> 
+                        int (lc) <> text ". time"
hunk ./src/Igor2/SynthesisEngine.hs 113
-    getEvidence >>= \io -> llogDE ( linebreak <> text "IGOR initialised to:" <$> indent 2 (pretty io))
+    getEvidence >>= \io -> llogDE ( linebreak <> text "IGOR initialised to:" <$> 
+                                   indent 2 (pretty io))
hunk ./src/Igor2/SynthesisEngine.hs 122
-     else if (debug && atMxL) then llogNO (text "MaxLoops reached") >> stopWith hypos
+     else if (debug && atMxL) 
+          then llogNO (text "MaxLoops reached") >> stopWith hypos
hunk ./src/Igor2/SynthesisEngine.hs 126
-        else do llogNO (linebreak <> text "FIRST HYPOS FINISHED: reduce" <+>
-                       text "SearchSpace and finish tier!" <> linebreak)
+        else do llogNO ( linebreak <> text "FIRST HYPOS FINISHED: reduce" <+>
+                         text "SearchSpace and finish tier!" <> linebreak)
hunk ./src/Igor2/SynthesisEngine.hs 139
-finishTier ejcts cnds hsp = (lift . lift . lift . lift) (pushHypos ejcts hsp) >>= continue cnds
+finishTier ejcts cnds hsp = lift4 (pushHypos ejcts hsp) >>= continue cnds
hunk ./src/Igor2/SynthesisEngine.hs 143
-    hsp'  <- lift . lift . lift . lift $ (pushHypos (tail cnds) hsp >>= pushHypos ahs)  
+    hsp'  <- lift4 $ (pushHypos (tail cnds) hsp >>= pushHypos ahs)  
hunk ./src/Igor2/SynthesisEngine.hs 146
-exhausted = llogNO(linebreak <> text "SEARCHSPACE EXHAUSTED - - STOP" <> linebreak) >>
+exhausted = llogNO( linebreak <> text "SEARCHSPACE EXHAUSTED - - STOP" <> 
+                    linebreak) >>
hunk ./src/Igor2/SynthesisEngine.hs 149
+            
hunk ./src/Igor2/SynthesisEngine.hs 165
+lift4 = lift . lift . lift . lift