crdt-event-fold 1.3.0.0 → 1.4.0.0
raw patch · 2 files changed
+9/−7 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.CRDT.EventFold.Monad: getResult :: MonadUpdateEF o p e m => m (UpdateResult o p e)
Files
crdt-event-fold.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: crdt-event-fold-version: 1.3.0.0+version: 1.4.0.0 synopsis: Garbage collected event folding CRDT. description: Garbage collected event folding CRDT. Consistently apply arbitrary operations to replicated data.
src/Data/CRDT/EventFold/Monad.hs view
@@ -3,9 +3,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE LambdaCase #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wmissing-import-lists #-}@@ -22,7 +19,8 @@ import Control.Monad.IO.Class (MonadIO) import Control.Monad.Logger (MonadLogger, MonadLoggerIO) import Control.Monad.Reader (MonadReader(ask), ReaderT(runReaderT))-import Control.Monad.State (MonadState(state), StateT, gets, runStateT)+import Control.Monad.State (MonadState(state), StateT, get, gets,+ runStateT) import Control.Monad.Trans.Class (MonadTrans(lift)) import Data.CRDT.EventFold (Event(Output), UpdateResult(UpdateResult), Diff, EventFold, EventId, MergeError, urEventFold)@@ -59,7 +57,10 @@ {- | Remove a peer from participation. See 'EF.disassociate'. -} disassociate :: p -> m (EventId p) + {- | Get the outstanding update results. -}+ getResult :: m (UpdateResult o p e) + {- | Interface for inspecting an Eventfold contained within the monadic context.@@ -134,7 +135,9 @@ disassociate participant = withEF (\ef _self -> EF.disassociate participant ef) + getResult = EventFoldT get + {- | EventFoldT helper to make sure we always do the right thing when updating an event.@@ -168,9 +171,8 @@ of the consistent outputs, and a flag indicating whether the new 'EventFold' value should be propagated to the other participants. -}-runEventFoldT self ef action = do+runEventFoldT self ef = do flip runReaderT self . flip runStateT (UpdateResult ef mempty False) . unEventFoldT - $ action