acid-state 0.14.2 → 0.14.3
raw patch · 5 files changed
+14/−90 lines, 5 filesdep ~basedep ~mtlPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, mtl
API changes (from Hackage documentation)
Files
- acid-state.cabal +2/−2
- examples/MultipleCheckpoint.hs +0/−77
- src/Data/Acid.hs +1/−1
- src/Data/Acid/Core.hs +8/−9
- src/Data/Acid/TemplateHaskell.hs +3/−1
acid-state.cabal view
@@ -1,8 +1,8 @@ Name: acid-state-Version: 0.14.2+Version: 0.14.3 Synopsis: Add ACID guarantees to any serializable Haskell data structure. Description: Use regular Haskell data structures as your database and get stronger ACID guarantees than most RDBMS offer.-Homepage: http://acid-state.seize.it/+Homepage: https://github.com/acid-state/acid-state License: PublicDomain Author: David Himmelstrup Maintainer: Lemmih <lemmih@gmail.com>
− examples/MultipleCheckpoint.hs
@@ -1,77 +0,0 @@-{-# LANGUAGE DeriveDataTypeable #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeFamilies #-}--module Main (main) where--import Data.Acid--import Control.Concurrent-import Control.Monad.State-import Data.SafeCopy-import Data.Time-import System.IO----------------------------------------------------------- The Haskell structure that we want to encapsulate--data SlowCheckpoint = SlowCheckpoint Int Int--$(deriveSafeCopy 0 'base ''SlowCheckpoint)----------------------------------------------------------- The transaction we will execute over the state.---- This transaction adds a very computationally heavy entry--- into our state. However, since the state is lazy, the--- chunk will not be forced until we create a checkpoint.--- Computing 'last [0..100000000]' takes roughly 2 seconds--- on my machine. XXX Lemmih, 2011-04-26-setComputationallyHeavyData :: Update SlowCheckpoint ()-setComputationallyHeavyData = do SlowCheckpoint _slow tick <- get- put $ SlowCheckpoint (last [0..100000000]) tick--tick :: Update SlowCheckpoint Int-tick = do SlowCheckpoint slow tick <- get- put $ SlowCheckpoint slow (tick+1)- return tick--$(makeAcidic ''SlowCheckpoint ['setComputationallyHeavyData, 'tick])----------------------------------------------------------- This is how AcidState is used:--main :: IO ()-main = do acid <- openLocalStateFrom "state/SlowCheckpoint" (SlowCheckpoint 0 0)- doTick acid- createCheckpoint acid- doTick acid- createCheckpoint acid- doTick acid- createCheckpoint acid- createArchive acid- pure ()-{-- update acid SetComputationallyHeavyData- forkIO $ do putStrLn "Seriazing checkpoint..."- t <- timeIt $ createCheckpoint acid- t <- timeIt $ createCheckpoint acid- putStrLn $ "Checkpoint created in: " ++ show t- replicateM_ 20 $- do doTick acid- threadDelay (10^5)--}--- threadDelay (10^6)--- tick <- update acid Tick--- threadDelay (10^6)--- createArchive acid--doTick acid- = do tick <- update acid Tick- putStrLn $ "Tick: " ++ show tick--timeIt action- = do t1 <- getCurrentTime- ret <- action- t2 <- getCurrentTime- return (diffUTCTime t2 t1)
src/Data/Acid.hs view
@@ -9,7 +9,7 @@ AcidState container using a transaction log on disk. To see how it all fits together, have a look at these example- <http://mirror.seize.it/acid-state/examples/>.+ <https://github.com/acid-state/acid-state/tree/master/examples>. -}
src/Data/Acid/Core.hs view
@@ -46,12 +46,16 @@ import Data.Serialize ( runPutLazy, runGetLazy ) import Data.SafeCopy ( SafeCopy, safeGet, safePut ) -import Data.Typeable ( Typeable, TypeRep, typeOf )+import Data.Typeable ( Typeable, TypeRep, typeRepTyCon, typeOf ) import Unsafe.Coerce ( unsafeCoerce ) -#if MIN_VERSION_base(4,4,0)+#if MIN_VERSION_base(4,5,0)+import Data.Typeable ( tyConModule )+#else+import Data.Typeable.Internal ( tyConModule )+#endif -import Data.Typeable.Internal ( TypeRep (..), tyConModule )+#if MIN_VERSION_base(4,4,0) -- in base >= 4.4 the Show instance for TypeRep no longer provides a -- fully qualified name. But we have old data around that expects the@@ -60,12 +64,7 @@ -- end-of-life anyway. showQualifiedTypeRep :: TypeRep -> String showQualifiedTypeRep tr = tyConModule con ++ "." ++ show tr- where con = extractTypeRepCon tr-#if MIN_VERSION_base(4,8,0)- extractTypeRepCon (TypeRep _ c _ _) = c-#else- extractTypeRepCon (TypeRep _ c _) = c-#endif+ where con = typeRepTyCon tr #else
src/Data/Acid/TemplateHaskell.hs view
@@ -226,7 +226,9 @@ -- deriving (Typeable) makeEventDataType eventName eventType = do let con = normalC eventStructName [ strictType notStrict (return arg) | arg <- args ]-#if MIN_VERSION_template_haskell(2,11,0)+#if MIN_VERSION_template_haskell(2,12,0)+ cxt = [derivClause Nothing [conT ''Typeable]]+#elif MIN_VERSION_template_haskell(2,11,0) cxt = mapM conT [''Typeable] #else cxt = [''Typeable]