packages feed

ron-schema 0.5 → 0.6

raw patch · 4 files changed

+139/−6 lines, 4 files

Files

+ CHANGELOG.md view
@@ -0,0 +1,104 @@+# Changelog+All notable changes to this project will be documented in this file.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0)+and this project adheres to+[Compatible Versioning](https://github.com/staltz/comver).++## [Unreleased]++## [0.6] - 2019-04-25+### Added+- Schema language: `RGA` type.++## [0.5] - 2019-02-04+### Added+- `RON.UUID.liftName` function to create name UUIDs in compile time.+- `RON.Util.ByteStringL` type.+- `RON.Error` module with unified pretty errors.+- Organize `Replicated`, `ReplicatedAsPayload`, and `ReplicatedAsObject` in+  class hierarchy.+- Add `ORSet.removeValue` and `removeRef` implementation.+- Op "patterns" and patterns.++### Removed+- Type alias `ObjectId` since objects are identified by UUID.++### Changed+- Extracted `ron-storage` package.+- Extracted `ron-schema` package.+- Extracted `ron-rdt` package.+- Switched from `Either String a` to `MonadError String m => m a` in failable+  procedures.+- `ORSet.addRef` now adds item's frame, too.+- `ORSet.addNewRef` now returns the reference to the freshly created object.+- Change `StateFrame` key to UUID since objects are identified by UUID.+- Renamed `RawOp` to `ClosedOp` according to the fresh spec.++### Fixed+- Error handling in Boole decoder.++## [0.4] - 2019-01-09+### Added+- Schema `enum` declaration.+- `docIdFromUuid`.+- `OnDocumentChanged` is called each time when any document is changed.++### Changed+- Made GHC 8.6 default.++### Removed+- Schema embedded DSL helpers: `atomInteger`, `atomString`, `boole`, `char`,+  `field`, `option`, `orSet`, `rgaString`, `structLww`, `versionVector`.++### Fixed+- `RGA.edit` bug with re-adding deleted items (#39).++## [0.3] - 2018-12-05+### Added+- Encode/decode EpochTime.+- EDN-based schema DSL.++### Removed+- `RON.Storage.createVersion` from public API.+- `NFData` instances.++## [0.2] - 2018-11-20+### Added+- Schema boole type.+- RON.Storage and submodules are moved from ff project.+- RON.Schema is now re-exported via RON.Schema.TH.++### Changed+- Renamed UUID field "schema" to "version", according to changes in the+  specification.+- RGA: sequential UUIDs on initialization.+- Optimized `Base64.isLetter`.+- Extend `UUID.mkName` to accept any monad.+- Renamed `MonadStorage` methods `list...` -> `get...`+- Renamed `RON.Storage.saveDocument` -> `createDocument`++### Removed+- `RON.Storage.uuidToFileName` as it has no sense as an abstraction+- `RON.Storage.IO.runStorageT` with `StorageT`++## [0.1] - 2018-11-08+### Added+- Package `ron`+  - RON-text format+  - RON-binary format+  - RON-RDT:+    - LWW+    - RGA+    - OR-Set+    - VersionVector+  - RON-Schema+  - RON-Schema TemplateHaskell code generator++[Unreleased]: https://github.com/ff-notes/ff/compare/ron-schema-0.6...HEAD+[0.6]: https://github.com/ff-notes/ff/compare/v0.5...ron-schema-0.6+[0.5]: https://github.com/ff-notes/ff/compare/v0.4...v0.5+[0.4]: https://github.com/ff-notes/ff/compare/v0.3...v0.4+[0.3]: https://github.com/ff-notes/ff/compare/v0.2...v0.3+[0.2]: https://github.com/ff-notes/ff/compare/v0.1...v0.2+[0.1]: https://github.com/ff-notes/ff/tree/v0.1
lib/RON/Schema/EDN.hs view
@@ -47,6 +47,7 @@     , ("VersionVector", Type0 $ TObject TVersionVector)     , ("Option",        Type1 $ TComposite . TOption)     , ("ORSet",         Type1 $ TObject . TORSet)+    , ("RGA",           Type1 $ TObject . TRga)     ]   where     char = opaqueAtoms "Char" OpaqueAnnotations{oaHaskellType = Just "Char"}
prelude/Prelude.hs view
@@ -5,13 +5,18 @@     module X,     fmapL,     foldr1,+    headMay,     identity,     lastDef,     maximumDef,     maxOn,     minOn,+    note,+    replicateM2,+    replicateM3,     show,     whenJust,+    (!!),     (?:), ) where @@ -40,10 +45,11 @@ import           Data.Int as X (Int, Int16, Int32, Int64, Int8) import           Data.IORef as X (IORef, atomicModifyIORef', newIORef,                                   readIORef, writeIORef)-import           Data.List as X (filter, genericLength, intercalate, isPrefixOf,-                                 isSuffixOf, lookup, map, partition, repeat,-                                 replicate, sortBy, sortOn, span, splitAt, take,-                                 takeWhile, unlines, unwords, zip, (++))+import           Data.List as X (drop, filter, genericLength, intercalate,+                                 isPrefixOf, isSuffixOf, lookup, map, partition,+                                 repeat, replicate, sortBy, sortOn, span,+                                 splitAt, take, takeWhile, unlines, unwords,+                                 zip, (++)) import           Data.List.NonEmpty as X (NonEmpty ((:|)), nonEmpty) import           Data.Maybe as X (Maybe (Just, Nothing), catMaybes, fromMaybe,                                   listToMaybe, maybe, maybeToList)@@ -131,6 +137,11 @@ foldr1 :: (a -> a -> a) -> NonEmpty a -> a foldr1 = Data.Foldable.foldr1 +headMay :: [a] -> Maybe a+headMay = \case+    []  -> Nothing+    a:_ -> Just a+ identity :: a -> a identity x = x @@ -151,11 +162,25 @@ minOn :: Ord b => (a -> b) -> a -> a -> a minOn f x y = if f x < f y then x else y +note :: e -> Maybe a -> Either e a+note e = maybe (Left e) Right++replicateM2 :: Applicative m => m a -> m (a, a)+replicateM2 ma = (,) <$> ma <*> ma++replicateM3 :: Applicative m => m a -> m (a, a, a)+replicateM3 ma = (,,) <$> ma <*> ma <*> ma+ show :: (Show a, IsString s) => a -> s show = fromString . Text.Show.show  whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m () whenJust m f = maybe (pure ()) f m++(!!) :: [a] -> Int -> Maybe a+xs !! i+    | i < 0     = Nothing+    | otherwise = headMay $ drop i xs  -- | An infix form of 'fromMaybe' with arguments flipped. (?:) :: Maybe a -> a -> a
ron-schema.cabal view
@@ -1,7 +1,7 @@ cabal-version:  2.2  name:           ron-schema-version:        0.5+version:        0.6  bug-reports:    https://github.com/ff-notes/ron/issues category:       Distributed Systems, Protocol, Database@@ -19,7 +19,7 @@     .     > import RON.Data     > import RON.Schema.TH-    > import RON.Storage.IO as Storage+    > import RON.Storage.FS as Storage     >     > [mkReplicated|     >     (struct_lww Note@@ -40,6 +40,9 @@     >         createDocument obj  build-type:     Simple++extra-source-files:+    CHANGELOG.md  common language     build-depends: base >= 4.10 && < 4.13, integer-gmp