crdt 5.0 → 5.1
raw patch · 2 files changed
+12/−7 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ CRDT.LamportClock: data LamportClock a
+ CRDT.LamportClock: runLamportClock :: TVar LocalTime -> LamportClock a -> IO a
+ CRDT.LamportClock: type LocalTime = Natural
Files
- crdt.cabal +2/−2
- lib/CRDT/LamportClock.hs +10/−5
crdt.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 35a8e5d951dbc5cec14577596c73f14d73ebf453af76b242e01beea8cf404d5c+-- hash: 119c02ebf0320abefdddcca20148e0f5af6faf20dd40832108eb06a9f330705e name: crdt-version: 5.0+version: 5.1 synopsis: Conflict-free replicated data types description: Definitions of CmRDT and CvRDT. Implementations for some classic CRDTs. category: Distributed Systems
lib/CRDT/LamportClock.hs view
@@ -5,14 +5,16 @@ -- * Lamport timestamp (for a single process) , Clock (..) , LamportTime (..)- -- * Lamport clock (for a whole multi-process system)- , LamportClockSim (..)- , runLamportClockSim- -- * Process+ , LocalTime , Process (..)- -- * ProcessSim+ -- * Lamport clock simulation+ , LamportClockSim (..) , ProcessSim (..)+ , runLamportClockSim , runProcessSim+ -- * Real Lamport clock+ , LamportClock+ , runLamportClock ) where import Control.Concurrent.STM (TVar, atomically, modifyTVar',@@ -107,6 +109,9 @@ -- TODO(cblp, 2018-01-06) benchmark and compare with 'atomicModifyIORef' newtype LamportClock a = LamportClock (ReaderT (TVar LocalTime) IO a) deriving (Applicative, Functor, Monad, MonadIO)++runLamportClock :: TVar LocalTime -> LamportClock a -> IO a+runLamportClock var (LamportClock action) = runReaderT action var instance Process LamportClock where getPid = liftIO getPidByMac