packages feed

appendful 0.1.0.0 → 0.2.0.0

raw patch · API changes only · 4 files changed · show whitespace changes · browse appendful-0.2.0.0

+29/−10 lines, 4 filessetup-changedPVP ok

API changes (from Hackage documentation)

0 removed, 0 added, 11 changed

version bump matches the API change (PVP)

- Data.Appendful.Collection: ClientSyncProcessor :: (Map ci si -> m ()) -> (Map si a -> m ()) -> ClientSyncProcessor ci si a m
+ Data.Appendful.Collection: ClientSyncProcessor :: (Map ci si -> m ()) -> (Map si a -> m ()) -> ClientSyncProcessor ci si a (m :: Type -> Type)
- Data.Appendful.Collection: ServerSyncProcessor :: m (Map si a) -> (Map ci a -> m (Map ci si)) -> ServerSyncProcessor ci si a m
+ Data.Appendful.Collection: ServerSyncProcessor :: (Maybe si -> m (Map si a)) -> (Map ci a -> m (Map ci si)) -> ServerSyncProcessor ci si a (m :: Type -> Type)
- Data.Appendful.Collection: [clientSyncProcessorSyncClientAdded] :: ClientSyncProcessor ci si a m -> Map ci si -> m ()
+ Data.Appendful.Collection: [clientSyncProcessorSyncClientAdded] :: ClientSyncProcessor ci si a (m :: Type -> Type) -> Map ci si -> m ()
- Data.Appendful.Collection: [clientSyncProcessorSyncServerAdded] :: ClientSyncProcessor ci si a m -> Map si a -> m ()
+ Data.Appendful.Collection: [clientSyncProcessorSyncServerAdded] :: ClientSyncProcessor ci si a (m :: Type -> Type) -> Map si a -> m ()
- Data.Appendful.Collection: [serverSyncProcessorAddItems] :: ServerSyncProcessor ci si a m -> Map ci a -> m (Map ci si)
+ Data.Appendful.Collection: [serverSyncProcessorAddItems] :: ServerSyncProcessor ci si a (m :: Type -> Type) -> Map ci a -> m (Map ci si)
- Data.Appendful.Collection: [serverSyncProcessorRead] :: ServerSyncProcessor ci si a m -> m (Map si a)
+ Data.Appendful.Collection: [serverSyncProcessorRead] :: ServerSyncProcessor ci si a (m :: Type -> Type) -> Maybe si -> m (Map si a)
- Data.Appendful.Collection: data ClientSyncProcessor ci si a m
+ Data.Appendful.Collection: data ClientSyncProcessor ci si a (m :: Type -> Type)
- Data.Appendful.Collection: data ServerSyncProcessor ci si a m
+ Data.Appendful.Collection: data ServerSyncProcessor ci si a (m :: Type -> Type)
- Data.Appendful.Collection: mergeSyncResponse :: forall ci si a. (Ord ci, Ord si) => ClientStore ci si a -> SyncResponse ci si a -> ClientStore ci si a
+ Data.Appendful.Collection: mergeSyncResponse :: (Ord ci, Ord si) => ClientStore ci si a -> SyncResponse ci si a -> ClientStore ci si a
- Data.Appendful.Collection: processServerSyncCustom :: forall ci si a m. (Ord si, Monad m) => ServerSyncProcessor ci si a m -> SyncRequest ci si a -> m (SyncResponse ci si a)
+ Data.Appendful.Collection: processServerSyncCustom :: forall ci si a m. Monad m => ServerSyncProcessor ci si a m -> SyncRequest ci si a -> m (SyncResponse ci si a)
- Data.Appendful.Collection: pureClientSyncProcessor :: forall ci si a. (Ord ci, Ord si) => ClientSyncProcessor ci si a (State (ClientStore ci si a))
+ Data.Appendful.Collection: pureClientSyncProcessor :: (Ord ci, Ord si) => ClientSyncProcessor ci si a (State (ClientStore ci si a))

Files

+ ChangeLog.md view
@@ -0,0 +1,15 @@+# Changelog for appendful++## [0.2.0.0] - 2025-09-19++### Changed++* The server sync processor now loads only the diff instead of the entire+  database to process a sync request.++## [0.1.0.0] - 2022-06-19++### Added++* Autodocodec support+
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
appendful.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.7.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack  name:           appendful-version:        0.1.0.0+version:        0.2.0.0 description:    Append-only cooperative agreement homepage:       https://github.com/NorfairKing/appendful#readme bug-reports:    https://github.com/NorfairKing/appendful/issues@@ -14,6 +14,8 @@ copyright:      Copyright: (c) 2020-2022 Tom Sydney Kerckhove license:        MIT build-type:     Simple+extra-source-files:+    ChangeLog.md  source-repository head   type: git
src/Data/Appendful/Collection.hs view
@@ -334,7 +334,7 @@   }   deriving (Generic) -mergeSyncResponseCustom :: Monad m => ClientSyncProcessor ci si a m -> SyncResponse ci si a -> m ()+mergeSyncResponseCustom :: (Monad m) => ClientSyncProcessor ci si a m -> SyncResponse ci si a -> m () mergeSyncResponseCustom ClientSyncProcessor {..} SyncResponse {..} = do   -- The order here matters!   clientSyncProcessorSyncServerAdded syncResponseServerAdded@@ -342,20 +342,20 @@  -- | A record of the basic operations that are necessary to build a synchronisation processor. data ServerSyncProcessor ci si a m = ServerSyncProcessor-  { serverSyncProcessorRead :: m (Map si a),+  { -- All items with an id greater than the given id+    serverSyncProcessorRead :: Maybe si -> m (Map si a),     serverSyncProcessorAddItems :: Map ci a -> m (Map ci si)   }   deriving (Generic)  processServerSyncCustom ::   forall ci si a m.-  (Ord si, Monad m) =>+  (Monad m) =>   ServerSyncProcessor ci si a m ->   SyncRequest ci si a ->   m (SyncResponse ci si a) processServerSyncCustom ServerSyncProcessor {..} SyncRequest {..} = do-  serverItems <- serverSyncProcessorRead-  let syncResponseServerAdded = maybe id (\ms -> M.dropWhileAntitone (<= ms)) syncRequestMaximumSynced serverItems+  syncResponseServerAdded <- serverSyncProcessorRead syncRequestMaximumSynced   syncResponseClientAdded <- serverSyncProcessorAddItems syncRequestAdded   pure SyncResponse {..} @@ -398,7 +398,7 @@   flip runStateT cs $     processServerSyncCustom       ServerSyncProcessor-        { serverSyncProcessorRead = gets serverStoreItems,+        { serverSyncProcessorRead = \ms -> gets (maybe id (\s -> M.dropWhileAntitone (<= s)) ms . serverStoreItems),           serverSyncProcessorAddItems = insertMany         }       sr@@ -414,11 +414,11 @@     modC :: (Map si a -> Map si a) -> StateT (ServerStore si a) m ()     modC func = modify (\(ServerStore m) -> ServerStore $ func m) -diffSet :: Ord si => Map si a -> Set si -> Map si a+diffSet :: (Ord si) => Map si a -> Set si -> Map si a diffSet m s = m `M.difference` toMap s  toMap :: Set si -> Map si () toMap = M.fromSet (const ()) -distinct :: Ord a => [a] -> Bool+distinct :: (Ord a) => [a] -> Bool distinct ls = sort ls == S.toAscList (S.fromList ls)