packages feed

TCache 0.8.0.1 → 0.8.0.2

raw patch · 4 files changed

+29/−44 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/TCache.hs view
@@ -168,11 +168,9 @@     buyIt[Just us,Just it]        | stock it > 0= [us',it']        | otherwise   = error \"stock is empty for this product\"-       where        us'= us{spent=spent us + price it}        it'= it{stock= stock it-1}-     buyIt _ = error \"either the user or the item (or both) does not exist\" @ -}@@ -211,21 +209,29 @@    Just owner <- readDBRef powner    writeDBRef powner owner{cars= delete  pcar $ cars owner} - main1= do+ main= do     'addTrigger' addCar     putStrLn \"create bruce's register with no cars\"     bruce \<- 'atomically' 'newDBRef' $ Person \"Bruce\" []-     putStrLn "add two car register with \"bruce\" as owner using the reference to the bruces register"     let newcars= [Car bruce \"Bat Mobile\" , Car bruce \"Porsche\"]     insert newcars-     Just bruceData \<- atomically $ 'readDBRef' bruce     putStrLn "the trigger automatically updated the car references of the Bruce register"     print . length $ cars bruceData     print bruceData @++produces:++gives:++> main+> 2+> Person {pname = "Bruce", cars = [DBRef "Car Porsche",DBRef "Car Bat Mobile"]}+ -}+ ,addTrigger 
 -- * cache control
Data/TCache/IResource.hs view
@@ -61,27 +61,8 @@          -- | is called syncronously. It must autocommit   
     	delResource:: a-> IO()
--{- | idempotentProperty k= do-       r <-  readResourceByKey k-       r' <- readResourceByKey k-       return (r == r')----idempotentProperty :: (IResource a) => a -> IO Bool-idempotentProperty x= do-   r <-  readResourceByKey $ keyResource x-   r' <- readResourceByKey $ keyResource x-   return (r == r') 
-readResource :: IResource a => a-> IO (Maybe a)
-readResource x= readResourceByKey $ keyResource x--}- 
-
-
 -- | Resources data definition used by 'withSTMResources'    
 data Resources a b        = Retry             -- ^ forces a retry@@ -137,11 +118,6 @@   serialize   :: a -> String   deserialize :: String -> a -{- | Read, Show,  instances are implicit instances of Serializable-instance (Show a, Read a) => Serializable a where-    serialize= show-    deserialize= read--}   defaultReadResource :: (Serializable a, Indexable a, Typeable a) =>  a -> IO (Maybe a)@@ -216,7 +192,7 @@  
 
--- Strict read from file, needed for default file persistence
+-- | Strict read from file, needed for default file persistence
 readFileStrict f = openFile f ReadMode >>= \ h -> readIt h `finally` hClose h   where   readIt h= do
Data/TCache/IndexQuery.hs view
@@ -1,21 +1,21 @@ {- | This module implements an experimental typed query language for TCache build on pure haskell. It is minimally intrusive (no special data definitions, no special syntax, no template-haskell). It uses the same register fields from the data definitions. Both for both query conditions+haskell). It uses the same register fields from the data definitions. Both for query conditions  and selections. It is executed in haskell, no external database support is needed.  it includes - - A method to trigger the 'index'-ation of values of the record fields that you want to query+ - A method for triggering the 'index'-ation of the record fields that you want to query - - A typed query language of these record fields, with+ - A typed query language of these record fields, with: -     * Relational operators:  '.==.' '.>.' '.>=.' '.<=.' '.<.' '.&&.' '.||.' to compare fields with-       values(returning lists of DBRefs) or fields between them, returning joins (lists of pairs of+     - Relational operators:  '.==.' '.>.' '.>=.' '.<=.' '.<.' '.&&.' '.||.' to compare fields with+       values (returning lists of DBRefs) or fields between them, returning joins (lists of pairs of        lists of DBRefs that meet the condition). -     * a 'select' method to extract tuples of field values from the  DBRefs+     - a 'select' method to extract tuples of field values from the  DBRefs -     * a 'recordsWith' clause to extract entire registers+     - a 'recordsWith' clause to extract entire registers  An example that register the owner and name fields fo the Car register and the name of the Person register, create the Bruce register, return the Bruce DBRef, create two Car registers with bruce as owner@@ -39,14 +39,15 @@    'index' cname    bruce <- atomically $ 'newDBRef' $ Person \"bruce\"    atomically $  mapM_ 'newDBRef' [Car bruce \"Bat Mobile\", Car bruce \"Porsche\"]--   r \<- atomically $ 'select' (cname, owner) $  (owner '.==.' bruce) '.&&.' (cname '.>.' \"Bat Mobile\")-+   r \<- atomically $ cname '.==.' \"Porsche\"    print r+   r \<- atomically $ 'select' (cname, owner) $  (owner '.==.' bruce) '.&&.' (cname '.>=.' \"Bat Mobile\")+   print r @  Will produce: +> [DBRef "Car Porsche"] > [("Porsche",DBRef "Person bruce")]  NOTES:@@ -57,11 +58,12 @@  * The Join feature has not been properly tested -* Record fields are recognized by its type, so+* Record fields are recognized by its type, so if we define two record fields+with the same type:  > data Person = Person {name , surname :: String} -@name '.==.' "Bruce"@  is equual to @surname '.==.' "Bruce"@+then a query for @name '.==.' "Bruce"@  is indistinguishable from @surname '.==.' "Bruce"@  Will return all the registers with surname "Bruce" as well. So if two or more fields in a registers are to be indexed, they must have different types.@@ -147,6 +149,7 @@         Nothing      -> []     return (rindex, Index index, dbrefs)+ selectorIndex   :: (Typeable reg,       IResource reg,
TCache.cabal view
@@ -1,5 +1,5 @@ name:                TCache-version:             0.8.0.1+version:             0.8.0.2 synopsis:            Data caching and Persistent STM transactions description: @@ -42,7 +42,7 @@ license-file:        LICENSE author:              Alberto Gómez Corona maintainer:          agocorona@gmail.com-Tested-With:         GHC == 6.12.3+Tested-With:         GHC == 7.0 Build-Type:          Simple build-Depends:       base >=4 && <5,directory >= 1.0, old-time >=1.0,stm>=2, containers >= 0.1.0.1,  transformers >=0.2 && <0.3