packages feed

data-serializer 0.3.2 → 0.3.3

raw patch · 1 files changed

+2/−2 lines, 1 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.Deserializer: class (Monad μ, Parsing μ) => Deserializer μ where endian _ = LittleEndian word8 = unsafeHead <$> take 1 <?> "word8" word16 = getIn (endian (Proxy :: Proxy μ)) word32 = getIn (endian (Proxy :: Proxy μ)) word64 = getIn (endian (Proxy :: Proxy μ)) word16L = (<?> "word16") $ do { bs <- take 2; let l = unsafeIndex bs 0 h = unsafeIndex bs 1; return $ shiftL (fromIntegral h) 8 .|. fromIntegral l } word16B = swapEndian <$> word16L word32L = (<?> "word32") $ do { bs <- take 4; let o₀ = unsafeIndex bs 0 o₁ = unsafeIndex bs 1 o₂ = unsafeIndex bs 2 o₃ = unsafeIndex bs 3; return $ shiftL (fromIntegral o₃) 24 .|. shiftL (fromIntegral o₂) 16 .|. shiftL (fromIntegral o₁) 8 .|. fromIntegral o₀ } word32B = swapEndian <$> word32L word64L = (<?> "word64") $ do { bs <- take 8; let o₀ = unsafeIndex bs 0 o₁ = unsafeIndex bs 1 o₂ = unsafeIndex bs 2 o₃ = unsafeIndex bs 3 o₄ = unsafeIndex bs 4 o₅ = unsafeIndex bs 5 o₆ = unsafeIndex bs 6 o₇ = unsafeIndex bs 7; return $ shiftL (fromIntegral o₇) 56 .|. shiftL (fromIntegral o₆) 48 .|. shiftL (fromIntegral o₅) 40 .|. shiftL (fromIntegral o₄) 32 .|. shiftL (fromIntegral o₃) 24 .|. shiftL (fromIntegral o₂) 16 .|. shiftL (fromIntegral o₁) 8 .|. fromIntegral o₀ } word64B = swapEndian <$> word64L satisfy p = do { w <- word8; if p w then return w else unexpected (show w) } byte w = (<?> "byte " ++ show w) $ do { w' <- word8; if w' == w then return w' else unexpected (show w') } notByte w = (<?> "not byte " ++ show w) $ do { w' <- word8; if w' == w then unexpected (show w') else return w' } bytes bs = (<?> "bytes " ++ show (unpack bs)) $ do { bs' <- take (length bs); if bs' == bs then return bs' else unexpected (show $ unpack bs') } skip n | n <= 0 = pure () | otherwise = word8 *> skip (n - 1) ensure_ = (() <$) . ensure
+ Data.Deserializer: class (Monad μ, Parsing μ) => Deserializer μ
- Data.Serializer: class (Semigroup s, Monoid s) => Serializer s where endian _ = LittleEndian word16 = putIn (endian (Proxy :: Proxy s)) word32 = putIn (endian (Proxy :: Proxy s)) word64 = putIn (endian (Proxy :: Proxy s)) word16L w = word8 (fromIntegral w) <> word8 (fromIntegral (shiftR w 8)) word16B = word16L . swapEndian word32L w = word8 (fromIntegral w) <> word8 (fromIntegral (shiftR w 8)) <> word8 (fromIntegral (shiftR w 16)) <> word8 (fromIntegral (shiftR w 24)) word32B = word32L . swapEndian word64L w = word8 (fromIntegral w) <> word8 (fromIntegral (shiftR w 8)) <> word8 (fromIntegral (shiftR w 16)) <> word8 (fromIntegral (shiftR w 24)) <> word8 (fromIntegral (shiftR w 32)) <> word8 (fromIntegral (shiftR w 40)) <> word8 (fromIntegral (shiftR w 48)) <> word8 (fromIntegral (shiftR w 56)) word64B = word64L . swapEndian byteString = mconcat . fmap word8 . unpack shortByteString = mconcat . fmap word8 . unpack lazyByteString = mconcat . fmap byteString . toChunks builder = lazyByteString . toLazyByteString
+ Data.Serializer: class (Semigroup s, Monoid s) => Serializer s

Files

data-serializer.cabal view
@@ -1,5 +1,5 @@ Name: data-serializer-Version: 0.3.2+Version: 0.3.3 Category: Data Stability: experimental Synopsis: Common API for serialization libraries@@ -20,7 +20,7 @@ Extra-Source-Files:   README.md -Tested-With: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2+Tested-With: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.1  Cabal-Version: >= 1.10.0 Build-Type: Simple