Changeset 2433 for src/Pugs/Types

Show
Ignore:
Timestamp:
04/28/05 13:59:35 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
3914
Message:

* STMification: All our IORefs are now TVars.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Types/Hash.hs

    r2221 r2433  
    66import Pugs.Internals 
    77import Pugs.Types 
     8import qualified Data.Map as Map 
    89 
    910type Index = VStr 
     
    1617        keys <- fetchKeys hv 
    1718        vals <- mapM (fetchVal hv) keys 
    18         return $ keys `zip` vals 
     19        return . Map.fromList $ keys `zip` vals 
    1920    store       :: a -> VHash -> Eval () 
    2021    store hv vals = do 
    2122        clear hv 
    22         forM_ vals $ \(key, val) -> do 
     23        forM_ (Map.assocs vals) $ \(key, val) -> do 
    2324            storeVal hv key val 
    2425    fetchElem   :: a -> Index -> Eval (IVar VScalar) -- autovivify 
     
    4041    fetchKeys   :: a -> Eval [Index] 
    4142    fetchKeys hv = do 
    42         pairs <- fetch hv 
    43         return $ map fst pairs 
     43        vals <- fetch hv 
     44        return $ Map.keys vals 
    4445    deleteElem  :: a -> Index -> Eval () 
    4546    existsElem  :: a -> Index -> Eval VBool