bond-haskell 0.1.4.0 → 0.1.4.1
raw patch · 5 files changed
+16/−16 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Bond.Schema.FieldDef: instance GHC.Generics.Constructor Data.Bond.Schema.FieldDef.C1_0FieldDef
- Data.Bond.Schema.FieldDef: instance GHC.Generics.Datatype Data.Bond.Schema.FieldDef.D1FieldDef
- Data.Bond.Schema.FieldDef: instance GHC.Generics.Selector Data.Bond.Schema.FieldDef.S1_0_0FieldDef
- Data.Bond.Schema.FieldDef: instance GHC.Generics.Selector Data.Bond.Schema.FieldDef.S1_0_1FieldDef
- Data.Bond.Schema.FieldDef: instance GHC.Generics.Selector Data.Bond.Schema.FieldDef.S1_0_2FieldDef
- Data.Bond.Schema.Metadata: instance GHC.Generics.Constructor Data.Bond.Schema.Metadata.C1_0Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Datatype Data.Bond.Schema.Metadata.D1Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Selector Data.Bond.Schema.Metadata.S1_0_0Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Selector Data.Bond.Schema.Metadata.S1_0_1Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Selector Data.Bond.Schema.Metadata.S1_0_2Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Selector Data.Bond.Schema.Metadata.S1_0_3Metadata
- Data.Bond.Schema.Metadata: instance GHC.Generics.Selector Data.Bond.Schema.Metadata.S1_0_4Metadata
- Data.Bond.Schema.SchemaDef: instance GHC.Generics.Constructor Data.Bond.Schema.SchemaDef.C1_0SchemaDef
- Data.Bond.Schema.SchemaDef: instance GHC.Generics.Datatype Data.Bond.Schema.SchemaDef.D1SchemaDef
- Data.Bond.Schema.SchemaDef: instance GHC.Generics.Selector Data.Bond.Schema.SchemaDef.S1_0_0SchemaDef
- Data.Bond.Schema.SchemaDef: instance GHC.Generics.Selector Data.Bond.Schema.SchemaDef.S1_0_1SchemaDef
- Data.Bond.Schema.StructDef: instance GHC.Generics.Constructor Data.Bond.Schema.StructDef.C1_0StructDef
- Data.Bond.Schema.StructDef: instance GHC.Generics.Datatype Data.Bond.Schema.StructDef.D1StructDef
- Data.Bond.Schema.StructDef: instance GHC.Generics.Selector Data.Bond.Schema.StructDef.S1_0_0StructDef
- Data.Bond.Schema.StructDef: instance GHC.Generics.Selector Data.Bond.Schema.StructDef.S1_0_1StructDef
- Data.Bond.Schema.StructDef: instance GHC.Generics.Selector Data.Bond.Schema.StructDef.S1_0_2StructDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Constructor Data.Bond.Schema.TypeDef.C1_0TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Datatype Data.Bond.Schema.TypeDef.D1TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Selector Data.Bond.Schema.TypeDef.S1_0_0TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Selector Data.Bond.Schema.TypeDef.S1_0_1TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Selector Data.Bond.Schema.TypeDef.S1_0_2TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Selector Data.Bond.Schema.TypeDef.S1_0_3TypeDef
- Data.Bond.Schema.TypeDef: instance GHC.Generics.Selector Data.Bond.Schema.TypeDef.S1_0_4TypeDef
- Data.Bond.Schema.Variant: instance GHC.Generics.Constructor Data.Bond.Schema.Variant.C1_0Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Datatype Data.Bond.Schema.Variant.D1Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_0Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_1Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_2Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_3Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_4Variant
- Data.Bond.Schema.Variant: instance GHC.Generics.Selector Data.Bond.Schema.Variant.S1_0_5Variant
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_0Struct
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_0Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_10Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_11Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_12Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_13Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_14Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_15Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_16Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_17Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_1Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_2Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_3Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_4Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_5Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_6Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_7Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_8Value
- Data.Bond.Struct: instance GHC.Generics.Constructor Data.Bond.Struct.C1_9Value
- Data.Bond.Struct: instance GHC.Generics.Datatype Data.Bond.Struct.D1Struct
- Data.Bond.Struct: instance GHC.Generics.Datatype Data.Bond.Struct.D1Value
- Data.Bond.Struct: instance GHC.Generics.Selector Data.Bond.Struct.S1_0_0Struct
- Data.Bond.Struct: instance GHC.Generics.Selector Data.Bond.Struct.S1_0_1Struct
+ Data.Bond.Internal.Imports: type family WriterM t :: * -> *;
+ Data.Bond.Internal.Imports: }
- Data.Bond.Internal.Imports: class Protocol t where type family ReaderM t :: * -> * type family WriterM t :: * -> *
+ Data.Bond.Internal.Imports: class Protocol t where type ReaderM t :: * -> * type WriterM t :: * -> * where {
- Data.Bond.Internal.Imports: fromString :: IsString a => String -> a
+ Data.Bond.Internal.Imports: fromString :: String -> a
Files
- bond-haskell.cabal +1/−1
- src/Data/Bond/Internal/BinaryUtils.hs +3/−3
- src/Data/Bond/Internal/CompactBinaryProto.hs +7/−7
- src/Data/Bond/Internal/TaggedProtocol.hs +4/−4
- test/Spec.hs +1/−1
bond-haskell.cabal view
@@ -1,5 +1,5 @@ name: bond-haskell-version: 0.1.4.0+version: 0.1.4.1 synopsis: Runtime support for BOND serialization description: Bond is a cross-platform framework for handling schematized data. It supports cross-language de/serialization and
src/Data/Bond/Internal/BinaryUtils.hs view
@@ -15,10 +15,10 @@ import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL --- XXX isolate is available in binary >= 0.7.2.0 (lts-3 and higher) only-isolate :: ReaderM t ~ B.Get => Int -> BondGet t a -> BondGet t a-isolate _ = Prelude.id+--isolate :: ReaderM t ~ B.Get => Int -> BondGet t a -> BondGet t a --isolate n (BondGet g) = BondGet $ B.isolate n g+isolate :: Int -> BondGet t a -> BondGet t a+isolate _ = id lookAhead :: ReaderM t ~ B.Get => BondGet t a -> BondGet t a lookAhead (BondGet g) = BondGet $ B.lookAhead g
src/Data/Bond/Internal/CompactBinaryProto.hs view
@@ -295,7 +295,7 @@ Right v -> return v putLazyByteString (BL.drop 4 stream) -getCompactFieldHeader :: (BondProto t, ReaderM t ~ B.Get) => BondGet t (BondDataType, Ordinal)+getCompactFieldHeader :: (ReaderM t ~ B.Get) => BondGet t (BondDataType, Ordinal) getCompactFieldHeader = do tag <- getWord8 case tag `shiftR` 5 of@@ -307,7 +307,7 @@ return (BondDataType $ fromIntegral $ tag .&. 31, Ordinal n) n -> return (BondDataType $ fromIntegral $ tag .&. 31, Ordinal (fromIntegral n)) -putCompactFieldHeader :: (BondProto t, WriterM t ~ ErrorT String B.PutM) => BondDataType -> Ordinal -> BondPut t+putCompactFieldHeader :: (WriterM t ~ ErrorT String B.PutM) => BondDataType -> Ordinal -> BondPut t putCompactFieldHeader t (Ordinal n) = let tbits = fromIntegral $ fromEnum t nbits = fromIntegral n@@ -363,7 +363,7 @@ bs <- getLazyByteString (fromIntegral size) return $ BondedStream $ BL.append (protoHeader sig ver) bs -skipVarInt :: forall t. (Protocol t, ReaderM t ~ B.Get) => BondGet t ()+skipVarInt :: forall t. (ReaderM t ~ B.Get) => BondGet t () skipVarInt = void (getVarInt :: BondGet t Word64) compactSkipType :: (TaggedProtocol t, ReaderM t ~ B.Get) => BondDataType -> BondGet t ()@@ -395,17 +395,17 @@ skip $ n * 2 | otherwise -> fail $ "Invalid type to skip " ++ bondTypeName t -putList :: forall a t. (TaggedProtocol t, WriterM t ~ ErrorT String B.PutM, BondType a) => [a] -> BondPut t+putList :: forall a t. (TaggedProtocol t, Monad (WriterM t), BondType a) => [a] -> BondPut t putList xs = do putListHeader (getWireType (Proxy :: Proxy a)) (length xs) mapM_ bondPut xs -putHashSet :: forall a t. (TaggedProtocol t, WriterM t ~ ErrorT String B.PutM, BondType a) => HashSet a -> BondPut t+putHashSet :: forall a t. (TaggedProtocol t, Monad (WriterM t), BondType a) => HashSet a -> BondPut t putHashSet xs = do putListHeader (getWireType (Proxy :: Proxy a)) (H.size xs) mapM_ bondPut $ H.toList xs -putSet :: forall a t. (TaggedProtocol t, WriterM t ~ ErrorT String B.PutM, BondType a) => Set a -> BondPut t+putSet :: forall a t. (TaggedProtocol t, Monad (WriterM t), BondType a) => Set a -> BondPut t putSet xs = do putListHeader (getWireType (Proxy :: Proxy a)) (S.size xs) mapM_ bondPut $ S.toList xs@@ -419,7 +419,7 @@ bondPut k bondPut v -putVector :: forall a t. (TaggedProtocol t, WriterM t ~ ErrorT String B.PutM, BondType a) => Vector a -> BondPut t+putVector :: forall a t. (TaggedProtocol t, Monad (WriterM t), BondType a) => Vector a -> BondPut t putVector xs = do putListHeader (getWireType (Proxy :: Proxy a)) (V.length xs) V.mapM_ bondPut xs
src/Data/Bond/Internal/TaggedProtocol.hs view
@@ -34,10 +34,10 @@ getTaggedStruct :: BondGet t Struct putFieldHeader :: BondDataType -> Ordinal -> BondPut t putListHeader :: (Integral a, FiniteBits a) => BondDataType -> a -> BondPut t- putTaggedStruct :: MonadError String (BondPutM t) => Struct -> BondPut t+ putTaggedStruct :: Struct -> BondPut t skipStruct :: BondGet t () skipRestOfStruct :: BondGet t ()- skipType :: TaggedProtocol t => BondDataType -> BondGet t ()+ skipType :: BondDataType -> BondGet t () getStruct :: forall a t. (Functor (ReaderM t), Monad (ReaderM t), TaggedProtocol t, BondStruct a) => StructLevel -> BondGet t a getStruct level = do@@ -203,9 +203,9 @@ then writer else throwError $ "element type do not match container type: " ++ bondTypeName td ++ " expected, " ++ bondTypeName realtd ++ " found" -writeTagged :: forall t. (MonadError String (BondPutM t), WriterM t ~ ErrorT String B.PutM, TaggedProtocol t) => t -> Struct -> Either String BL.ByteString+writeTagged :: forall t. (WriterM t ~ ErrorT String B.PutM, TaggedProtocol t) => t -> Struct -> Either String BL.ByteString writeTagged _ a = let BondPut g = putTaggedStruct a :: BondPut t in tryPut g -writeTaggedWithSchema :: (MonadError String (BondPutM t), WriterM t ~ ErrorT String B.PutM, TaggedProtocol t) => t -> StructSchema -> Struct -> Either String BL.ByteString+writeTaggedWithSchema :: (WriterM t ~ ErrorT String B.PutM, TaggedProtocol t) => t -> StructSchema -> Struct -> Either String BL.ByteString writeTaggedWithSchema t schema struct = checkStructSchema schema struct >>= writeTagged t
test/Spec.hs view
@@ -347,7 +347,7 @@ s <- hoistEither $ bondReadWithSchema JsonProto schema dat hoistEither $ bondWriteWithSchema JsonProto schema s -readAsType :: forall t a. (Show a, BondProto t, BondStruct a) => t -> Proxy a -> String -> Assertion+readAsType :: forall t a. (BondProto t, BondStruct a) => t -> Proxy a -> String -> Assertion readAsType p _ f = assertEither $ do dat <- readData (compatDataPath </> f) void $ hoistEither (bondRead p dat :: Either String a)