packages feed

TCache 0.10.2.3 → 0.10.2.4

raw patch · 2 files changed

+8/−5 lines, 2 files

Files

Data/TCache/Defs.hs view
@@ -101,9 +101,12 @@ class Serializable a  where   serialize   :: a -> B.ByteString   deserialize :: B.ByteString -> a+  deserialKey :: String -> B.ByteString -> a+  deserialKey _ v= deserialize v   setPersist  :: a -> Maybe Persist              -- ^ `defaultPersist` if Nothing   setPersist =  const Nothing +type Key= String --instance (Show a, Read a)=> Serializable a where --  serialize= show --  deserialize= read@@ -112,9 +115,9 @@ -- | a persist mechanism has to implement these three primitives -- 'filePersist' is the default file persistence data Persist = Persist{-       readByKey   ::  (String -> IO(Maybe B.ByteString)) -- ^  read by key. It must be strict-     , write       ::  (String -> B.ByteString -> IO())   -- ^  write. It must be strict-     , delete      ::  (String -> IO())}                  -- ^  delete+       readByKey   ::  (Key -> IO(Maybe B.ByteString)) -- ^  read by key. It must be strict+     , write       ::  (Key -> B.ByteString -> IO())   -- ^  write. It must be strict+     , delete      ::  (Key -> IO())}                  -- ^  delete  -- | Implements default persistence of objects in files with their keys as filenames filePersist   = Persist@@ -198,7 +201,7 @@ defReadResourceByKey k= iox where     iox= do       let Persist f _ _ = getPersist  x-      f  file >>=  evaluate . fmap  deserialize+      f  file >>=  evaluate . fmap  (deserialKey k)       where       file= defPath x ++ k       x= undefined `asTypeOf` (fromJust $ unsafePerformIO iox)
TCache.cabal view
@@ -1,5 +1,5 @@ name: TCache-version: 0.10.2.3+version: 0.10.2.4 cabal-version: >= 1.6 build-type: Simple license: BSD3