[Hypos now (Set Hypo), Data.MaySet extends Data.Set
martin.hofmann@uni-bamberg.de**20090126093028] hunk ./src/Data/Hypotheses.hs 8
-    Hypos, hypos,  emptyHs, singletonHs, nullHs, countHs,
-    mergeHs, insertHs, deleteHs, replaceHs, 
+    Hypos, hypos,  
+    openRules, closedRules, allRules, 
hunk ./src/Data/Hypotheses.hs 11
-    mbDeleteHs, mbInsertHs,
-    hyposToList,
-        
-    mapHs, mapHs', foldHs,
hunk ./src/Data/Hypotheses.hs 76
+closedRules :: Hypo -> Rules
+closedRules h = foldl' S.union S.empty (M.elems (clsd h))
+
+openRules :: Hypo -> Rules
+openRules h = (S.map frag(open h))
+
+allRules :: Hypo -> Rules
+allRules h = S.union (closedRules h) (openRules h)
hunk ./src/Data/Hypotheses.hs 131
-newtype Hypos = HHs {unHHs :: S.Set Hypo }
-    deriving(Eq, Ord)
-
-instance Show Hypos where
-    show  = show.pretty
-instance Pretty Hypos where
-	pretty (HHs s) = pretty s    
-    
-singletonHs :: Hypo -> Hypos
-singletonHs h = HHs $ S.singleton h
-
-hypos hs = HHs $ S.fromList hs
-
---hyposToSet = unHHs
-
-emptyHs :: Hypos
-emptyHs = HHs $ S.empty
-
-nullHs :: Hypos -> Bool   
-nullHs = S.null.unHHs  
-
-countHs :: Hypos -> Int
-countHs = S.size.unHHs
+type Hypos = S.Set Hypo 
hunk ./src/Data/Hypotheses.hs 133
-foldHs :: (Hypo -> a -> a) -> a -> Hypos -> a
-foldHs f i rs = foldl' (flip f) i (hyposToList rs) -- S.fold f i (unHHs rs)
-
-mapHs :: (Ord a) => (Hypo -> a) -> Hypos -> (Set a)
-mapHs f hs  = (S.map f) (unHHs hs)
-
-mapHs' :: (Hypo -> Maybe Hypo) -> Hypos -> Hypos
-mapHs' f hs = 
-    case mapM f (hyposToList hs) of
-        Just l  -> HHs $ S.fromList l
-        Nothing -> emptyHs 
-
-        
-mergeHs :: Hypos -> Hypos -> Hypos
-mergeHs hs1 hs2 = HHs $ S.union (unHHs hs1) (unHHs hs2)
-
-insertHs :: Hypo -> Hypos -> Hypos  
-insertHs h hs = HHs $ S.insert  h (unHHs hs)
-
-mbInsertHs :: Hypo -> Maybe Hypos -> Maybe Hypos
-mbInsertHs h hs = 
-    case hs of
-        Just hs' -> return $ insertHs h hs'
-        Nothing  -> return $ singletonHs h
-        
-deleteHs :: Hypo -> Hypos -> Hypos
-deleteHs h hs = HHs $ S.delete h (unHHs hs)
-
-mbDeleteHs :: Hypo -> Maybe Hypos -> Maybe Hypos
-mbDeleteHs _ Nothing   = Nothing 
-mbDeleteHs h (Just hs) = 
-    let hs' =  deleteHs h hs
-    in if nullHs hs' 
-         then Nothing
-         else Just hs'
-               
-replaceHs :: Hypo -> Hypo -> Hypos -> Hypos
-replaceHs h1 h2 hs = insertHs h1 (deleteHs h2 hs)
-
-hyposToList :: Hypos -> [Hypo]
-hyposToList = S.toList.unHHs
- 
+--instance Show Hypos where
+--    show  = show.pretty
+--instance Pretty Hypos where
+--	pretty (HHs s) = pretty s    
+--    
+--singletonHs :: Hypo -> Hypos
+--singletonHs h = HHs $ S.singleton h
+--
+hypos :: [Hypo] -> Hypos
+hypos = S.fromList
+--
+----hyposToSet = unHHs
+--
+--emptyHs :: Hypos
+--emptyHs = HHs $ S.empty
+--
+--nullHs :: Hypos -> Bool   
+--nullHs = S.null.unHHs  
+--
+--countHs :: Hypos -> Int
+--countHs = S.size.unHHs
+--
+--foldHs :: (Hypo -> a -> a) -> a -> Hypos -> a
+--foldHs f i rs = foldl' (flip f) i (hyposToList rs) -- S.fold f i (unHHs rs)
+--
+--mapHs :: (Ord a) => (Hypo -> a) -> Hypos -> (Set a)
+--mapHs f hs  = (S.map f) (unHHs hs)
+--
+--mapHs' :: (Hypo -> Maybe Hypo) -> Hypos -> Hypos
+--mapHs' f hs = 
+--    case mapM f (hyposToList hs) of
+--        Just l  -> HHs $ S.fromList l
+--        Nothing -> emptyHs 
+--
+--        
+--mergeHs :: Hypos -> Hypos -> Hypos
+--mergeHs hs1 hs2 = HHs $ S.union (unHHs hs1) (unHHs hs2)
+--
+--insertHs :: Hypo -> Hypos -> Hypos  
+--insertHs h hs = HHs $ S.insert  h (unHHs hs)
+--
+--mbInsertHs :: Hypo -> Maybe Hypos -> Maybe Hypos
+--mbInsertHs h hs = 
+--    case hs of
+--        Just hs' -> return $ insertHs h hs'
+--        Nothing  -> return $ singletonHs h
+--        
+--deleteHs :: Hypo -> Hypos -> Hypos
+--deleteHs h hs = HHs $ S.delete h (unHHs hs)
+--
+--mbDeleteHs :: Hypo -> Maybe Hypos -> Maybe Hypos
+--mbDeleteHs _ Nothing   = Nothing 
+--mbDeleteHs h (Just hs) = 
+--    let hs' =  deleteHs h hs
+--    in if nullHs hs' 
+--         then Nothing
+--         else Just hs'
+--               
+--replaceHs :: Hypo -> Hypo -> Hypos -> Hypos
+--replaceHs h1 h2 hs = insertHs h1 (deleteHs h2 hs)
+--
+--hyposToList :: Hypos -> [Hypo]
+--hyposToList = S.toList.unHHs
+-- 
hunk ./src/Data/IOData.hs 30
-import Data.Set (Set)
-import qualified Data.Set as S 
+import Data.MySet (Set)
+import qualified Data.MySet as S 
addfile ./src/Data/MySet.hs
hunk ./src/Data/MySet.hs 1
-
+
+module Data.MySet (
+
+    deleteM, insertM, replaceM,
+
+    module Data.Set
+    )where
+
+
+import Prelude hiding (null)
+import Data.Set
+import Control.Monad
+
+deleteM :: (Ord a) => a -> Maybe (Set a) -> Maybe (Set a)
+deleteM r rs = 
+    liftM (delete r) rs >>=  \rs' -> 
+        if null rs' then return rs' else Nothing
+
+insertM :: (Ord a) => a -> Maybe (Set a) -> Maybe (Set a)
+insertM  r rs   = 
+    case rs of
+        (Just rs') -> return $ insert r rs'
+        Nothing    -> return $ insert r empty
+
+replaceM r1 r2 = (insertM r2).(deleteM r1)
hunk ./src/Data/Rules.hs 8
-    
---    insertRs, deleteRs, replaceRs,
-    insertM, deleteM, replaceM, 
---    mapRs , foldRs,
---    -- *FIXME* necessary?
---    --union, 
---    rulesToList, rulesToSet,
---    rulesFromList, rulesFromSet,
-    
+
+    insertM, deleteM, replaceM,    
hunk ./src/Data/Rules.hs 105
+-- UNSAFE
hunk ./src/Data/Rules.hs 121
-        
--- DEPRECATED
-
---instance Show Rules where
---    show = show.pretty
---    
---instance Pretty Rules where
---	pretty (RS s) = pretty s
-
- 
---foldRs :: (Rule -> a -> a) -> a -> Rules -> a
---foldRs f i rs =  foldl' (flip f) i (rulesToList rs) -- S.fold f i (unRS rs)
---
---mapRs :: (Rule -> Rule) -> Rules -> Rules
---mapRs f rs  = RS $ (S.map f) (unRS rs)
---
---nullRs :: Rules -> Bool
---nullRs = S.null.unRS
---
---emptyRs :: Rules
---emptyRs = RS $ S.empty
---
---insertRs :: Rule -> Rules -> Rules
---insertRs r rs = RS $ (S.insert r) $ unRS rs
-
---insertRsM :: Rule -> Maybe Rules -> Maybe Rules
---insertRsM  r rs   = 
---    case rs of
---        (Just rs') -> return $ insertRs r rs'
---        Nothing    -> return $ insertRs r emptyRs
---
---deleteRs :: Rule -> Rules -> Rules
---deleteRs r rs = RS $ (S.delete r) $ unRS rs
---
-
---
---replaceRs :: Rule ->  -- ^replace old rule 
---           Rule ->  -- ^by new rule
---           Rules -> -- ^in some rules
---           Rules
---replaceRs r1 r2 = (insertRs r2).(deleteRs r1) 
---
---replaceRsM r1 r2 = (insertRsM r2).(deleteRsM r1)
---
----- *FIXME* necessary?
-----union :: Rules -> Rules -> Rules
-----union (RS rs1) (RS rs2) = RS $ S.union rs1 rs2
----- *FIXME* necessary?
---rulesFromList :: [Rule] -> Rules
---rulesFromList rs  = RS $ S.fromList rs
---
----- *FIXME* necessary?
---rulesFromSet :: Set Rule -> Rules
---rulesFromSet rs = RS rs
---
----- | An ascending ordered list of 'Rule's 
---rulesToList = S.toAscList.unRS
---rulesToSet = unRS
+     
hunk ./src/Rating/Rateable.hs 14
-import qualified Data.Set as S
+import qualified Data.MySet as S
hunk ./src/Rating/Rateable.hs 44
-noOfTotalRules h = 
-                 let clsdrs = foldl' S.union S.empty (M.elems (clsd h))
-                     openrs = (S.map frag(open h))
-                 in  S.size $ S.map lhs (S.union clsdrs openrs)
+noOfTotalRules h =  S.size $ S.map lhs (allRules h)
hunk ./src/SynthesisEngine.hs 10
-import qualified Data.Set as S --(null, findMin)
+import qualified Data.MySet as S
hunk ./src/SynthesisEngine.hs 67
-    let openrules = (foldHs collect S.empty hs) 
+    let openrules = (S.fold collect S.empty hs) 
hunk ./src/SynthesisEngine.hs 78
-       return $ map (M.toList.clsd) (hyposToList hs)
+       return $ map (M.toList.clsd) (S.toList hs)