['propagate' in HypoSpace and related in Hypos
martin.hofmann@uni-bamberg.de**20081124093039] hunk ./src/Data/HypoSpace.hs 3
-    HSpace, initHSpace, insert, delete, update,
+    HSpace, initHSpace, insert, delete, 
hunk ./src/Data/HypoSpace.hs 15
-import Data.Fragments (RuleFrag)
+import Data.Fragments (RuleFrag, RuleFrags)
hunk ./src/Data/HypoSpace.hs 18
-import Data.Hypotheses (Hypo, hypo, fold, Hypos, open, clsd, modify)
+import Data.Hypotheses (Hypo, hypo, fold, Hypos, open, clsd, develop, Call)
hunk ./src/Data/HypoSpace.hs 91
-update :: RuleFrag -> RuleFrag -> HSpace -> HSpace
-update ro rn hsp   = ins $ del hsp
+--update :: RuleFrag -> RuleFrag -> HSpace -> HSpace
+--update ro rn hsp   = ins $ del hsp
+--    
+--    where
+--    del = \sp -> Hs.fold delete sp affectedHs
+--    ins = \sp -> Hs.fold insert sp modifiedHs
+--    affectedHs = case M.lookup  ro (ruleHyposMap hsp) of 
+--                    Just hs -> hs
+--                    Nothing -> Hs.empty
+--    -- get all affected Hypos 
+--    modifiedHs = Hs.map (modify ro rn) affectedHs
+--    -- update the rules in each hypo     
+
+-- | /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
+propagate :: (RuleFrag,RuleFrags,[Call]) -> HSpace -> HSpace
+propagate pdata@(ro,_,_) hsp   = ins $ del hsp
hunk ./src/Data/HypoSpace.hs 111
-    del = \sp -> Hs.fold delete sp affectedHs
-    ins = \sp -> Hs.fold insert sp modifiedHs
+    del = \sp -> fold delete sp affectedHs
+    ins = \sp -> fold insert sp modifiedHs
hunk ./src/Data/HypoSpace.hs 117
-    modifiedHs = Hs.map (modify ro rn) affectedHs
+    modifiedHs = Hs.map' (develop pdata) affectedHs
hunk ./src/Data/HypoSpace.hs 120
-
hunk ./src/Data/HypoSpace.hs 126
- 
- 
-
--- DEPRECATED
----- | /alterPrios f k h/ alters the 'priorities' of 'h' at key position 'k' with
-----   function 'f' and leaves the other record lsots of 'h' unchanged
---alterPrios :: (Maybe Hypos -> Maybe Hypos) -> RatingData -> HSpace -> HSpace
---alterPrios f k (HSpace p r h) = let
---    p' = Q.alter f k p
---    in (HSpace p' r h)
---
----- | /alterRHM f r h/ alters the 'ruleHyposMap' of 'h' at key position 'k' with
-----   function 'f' and leaves the other record lsots of 'h' unchanged
---alterRHM :: (Maybe Hypos -> Maybe Hypos) -> Rule -> HSpace -> HSpace
---alterRHM f k (HSpace p r h) = let
---    r' = M.alter f k r
---    in (HSpace p r' h)
---
----- | folds all hypotheses in Hypos over the 'ruleHyposMap' of
-----   the HSpace using 'f'
---foldRHM :: (Rule -> M.Map Rule Hypos -> M.Map Rule Hypos)
---           -> Rules -> HSpace -> HSpace    
---foldRHM f hs (HSpace p r h) = let 
---    r' = R.fold f r hs
---    in (HSpace p r' h)
---
---
----- | /alterHRM f r h/ alters the 'hypoRateMap' of 'h' at key position 'k' with
-----   function 'f' and leaves the other record lsots of 'h' unchanged
---alterHRM :: (Maybe RatingData -> Maybe RatingData) -> Hypo -> HSpace -> HSpace
---alterHRM f k (HSpace p r h) = let
---    h' = M.alter f k h
---    in (HSpace p r h')   
---
---
----- | folds the elemens in the Set (usually hypos) over the 'hypoRateMap' of
-----   the HSpace using 'f'    
---foldHRM :: (a -> M.Map Hypo RatingData -> M.Map Hypo RatingData)
---           -> [a] -> HSpace -> HSpace    
---foldHRM f hs (HSpace p r h) = let
---    h' = foldr f h hs
---    in (HSpace p r h')   
hunk ./src/Data/HypoSpace.hs 128
-    
hunk ./src/Data/Hypotheses.hs 10
-    
-    map, fold
+    toList,
+        
+    map, map', fold,
hunk ./src/Data/Hypotheses.hs 14
+    module Data.CallDependencies
hunk ./src/Data/Hypotheses.hs 21
-import Control.Monad (foldM)
+import Control.Monad (foldM, liftM)
hunk ./src/Data/Hypotheses.hs 82
-develop :: (Monad m) => 
-        Hypo ->         -- the hypothese to develop 
-        RuleFrag ->     -- the RuleFrag that was changed
-        RuleFrags ->    -- the RuleFrags rsulting from the change
-        [Call] ->       -- a list of Calls 
-        m Hypo          -- the resulting hypothese in your favorite Monad
-develop h rf rfs calls = do 
+develop ::  (Monad m) => 
+        (RuleFrag        -- the RuleFrag that was changed
+        ,RuleFrags       -- the RuleFrags rsulting from the change
+        ,[Call]) ->      -- a list of Calls 
+        Hypo ->          -- the hypothese to develop 
+        m Hypo           -- the resulting hypothese in your favorite Monad
+develop (rf,rfs,calls) h = do 
hunk ./src/Data/Hypotheses.hs 146
+map' :: (Hypo -> Maybe Hypo) -> Hypos -> Hypos
+map' f hs = 
+    case mapM f (toList hs) of
+        Just l  -> HHs $ S.fromList l
+        Nothing -> empty 
+        
hunk ./src/Data/Hypotheses.hs 169
+
+toList :: Hypos -> [Hypo]
+toList = S.toList.unHHs