cborg 0.2.2.1 → 0.2.3.0
raw patch · 4 files changed
+97/−33 lines, 4 filesdep ~QuickCheckdep ~aesondep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, aeson, base, base64-bytestring, ghc-prim, tasty
API changes (from Hackage documentation)
Files
- ChangeLog.md +6/−0
- cborg.cabal +8/−8
- src/Codec/CBOR/Decoding.hs +1/−1
- src/Codec/CBOR/Pretty.hs +82/−24
ChangeLog.md view
@@ -1,5 +1,11 @@ # Revision history for cborg +## 0.2.3.1 -- 2020-05-10++* Bounds updates for GHC 8.10++* `Decoder` is now a `newtype`.+ ## 0.2.2.1 -- 2019-12-29 * Testsuite updates for GHC 8.8
cborg.cabal view
@@ -1,5 +1,5 @@ name: cborg-version: 0.2.2.1+version: 0.2.3.0 synopsis: Concise Binary Object Representation (CBOR) license: BSD3 license-file: LICENSE.txt@@ -13,7 +13,7 @@ build-type: Simple cabal-version: >= 1.10 tested-with:- GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC==8.8.1+ GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1 extra-source-files: ChangeLog.md@@ -83,11 +83,11 @@ build-depends: array >= 0.4 && < 0.6,- base >= 4.7 && < 5.0,+ base >= 4.7 && < 4.15, bytestring >= 0.10.4 && < 0.11, containers >= 0.5 && < 0.7, deepseq >= 1.0 && < 1.5,- ghc-prim >= 0.3.1.0 && < 0.6,+ ghc-prim >= 0.3.1.0 && < 0.7, half >= 0.2.2.3 && < 0.4, primitive >= 0.5 && < 0.8, text >= 1.1 && < 1.3@@ -134,20 +134,20 @@ build-depends: array >= 0.4 && < 0.6,- base >= 4.7 && < 5.0,+ base >= 4.7 && < 4.15, base-orphans, bytestring >= 0.10.4 && < 0.11, text >= 1.1 && < 1.3, cborg, aeson >= 0.7 && < 1.5,- base64-bytestring >= 1.0 && < 1.1,+ base64-bytestring >= 1.0 && < 1.2, base16-bytestring >= 0.1 && < 0.2, deepseq >= 1.0 && < 1.5, half >= 0.2.2.3 && < 0.4,- QuickCheck >= 2.9 && < 2.14,+ QuickCheck >= 2.9 && < 2.15, random, scientific >= 0.3 && < 0.4,- tasty >= 0.11 && < 1.3,+ tasty >= 0.11 && < 1.4, tasty-hunit >= 0.9 && < 0.11, tasty-quickcheck >= 0.8 && < 0.11, vector >= 0.10 && < 0.13
src/Codec/CBOR/Decoding.hs view
@@ -134,7 +134,7 @@ -- logic. -- -- @since 0.2.0.0-data Decoder s a = Decoder {+newtype Decoder s a = Decoder { runDecoder :: forall r. (a -> ST s (DecodeAction s r)) -> ST s (DecodeAction s r) }
src/Codec/CBOR/Pretty.hs view
@@ -28,11 +28,13 @@ import qualified Data.ByteString as S import qualified Data.Text as T +import Codec.CBOR.ByteArray.Sliced import Codec.CBOR.Encoding import Codec.CBOR.Write import qualified Control.Monad.Fail as Fail import Control.Monad (replicateM_)+import GHC.Int (Int64) import Numeric #if !MIN_VERSION_base(4,8,0) import Control.Applicative@@ -161,45 +163,90 @@ hexRep term str " " case term of- TkInt i TkEnd -> ppTkInt i- TkInteger i TkEnd -> ppTkInteger i- TkWord w TkEnd -> ppTkWord w- TkBytes bs TkEnd -> ppTkBytes bs- TkBytesBegin TkEnd -> ppTkBytesBegin- TkString t TkEnd -> ppTkString t- TkStringBegin TkEnd -> ppTkStringBegin- TkListLen w TkEnd -> ppTkListLen w- TkListBegin TkEnd -> ppTkListBegin- TkMapLen w TkEnd -> ppTkMapLen w- TkMapBegin TkEnd -> ppTkMapBegin- TkBreak TkEnd -> ppTkBreak- TkTag w TkEnd -> ppTkTag w- TkBool b TkEnd -> ppTkBool b- TkNull TkEnd -> ppTkNull- TkSimple w TkEnd -> ppTkSimple w- TkFloat16 f TkEnd -> ppTkFloat16 f- TkFloat32 f TkEnd -> ppTkFloat32 f- TkFloat64 f TkEnd -> ppTkFloat64 f- TkEncoded _ TkEnd -> ppTkEncoded- TkEnd -> str "# End of input"- _ -> fail $ unwords ["pprint: Unexpected token:", show term]+ TkInt i TkEnd -> ppTkInt i+ TkInt _ _ -> termFailure term+ TkInt64 i TkEnd -> ppTkInt64 i+ TkInt64 _ _ -> termFailure term+ TkInteger i TkEnd -> ppTkInteger i+ TkInteger _ _ -> termFailure term+ TkWord64 w TkEnd -> ppTkWord64 w+ TkWord64 _ _ -> termFailure term+ TkWord w TkEnd -> ppTkWord w+ TkWord _ _ -> termFailure term+ TkBytes bs TkEnd -> ppTkBytes bs+ TkBytes _ _ -> termFailure term+ TkBytesBegin TkEnd -> ppTkBytesBegin+ TkBytesBegin _ -> termFailure term+ TkByteArray ba TkEnd -> ppTkByteArray ba+ TkByteArray _ _ -> termFailure term+ TkUtf8ByteArray ba TkEnd -> ppTkUtf8ByteArray ba+ TkUtf8ByteArray _ _ -> termFailure term+ TkString t TkEnd -> ppTkString t+ TkString _ _ -> termFailure term+ TkStringBegin TkEnd -> ppTkStringBegin+ TkStringBegin _ -> termFailure term+ TkListLen w TkEnd -> ppTkListLen w+ TkListLen _ _ -> termFailure term+ TkListBegin TkEnd -> ppTkListBegin+ TkListBegin _ -> termFailure term+ TkMapLen w TkEnd -> ppTkMapLen w+ TkMapLen _ _ -> termFailure term+ TkMapBegin TkEnd -> ppTkMapBegin+ TkMapBegin _ -> termFailure term+ TkBreak TkEnd -> ppTkBreak+ TkBreak _ -> termFailure term+ TkTag w TkEnd -> ppTkTag w+ TkTag _ _ -> termFailure term+ TkTag64 w TkEnd -> ppTkTag64 w+ TkTag64 _ _ -> termFailure term+ TkBool b TkEnd -> ppTkBool b+ TkBool _ _ -> termFailure term+ TkNull TkEnd -> ppTkNull+ TkNull _ -> termFailure term+ TkUndef TkEnd -> ppTkUndef+ TkUndef _ -> termFailure term+ TkSimple w TkEnd -> ppTkSimple w+ TkSimple _ _ -> termFailure term+ TkFloat16 f TkEnd -> ppTkFloat16 f+ TkFloat16 _ _ -> termFailure term+ TkFloat32 f TkEnd -> ppTkFloat32 f+ TkFloat32 _ _ -> termFailure term+ TkFloat64 f TkEnd -> ppTkFloat64 f+ TkFloat64 _ _ -> termFailure term+ TkEncoded _ TkEnd -> ppTkEncoded+ TkEncoded _ _ -> termFailure term+ TkEnd -> str "# End of input"+ where+ termFailure t = fail $ unwords ["pprint: Unexpected token:", show t] ppTkInt :: Int -> PP () ppTkInt i = str "# int" >> parens (shown i) +ppTkInt64 :: Int64 -> PP ()+ppTkInt64 i = str "# int" >> parens (shown i)+ ppTkInteger :: Integer -> PP () ppTkInteger i = str "# integer" >> parens (shown i) +ppTkWord64 :: Word64 -> PP ()+ppTkWord64 w = str "# word" >> parens (shown w)+ ppTkWord :: Word -> PP () ppTkWord w = str "# word" >> parens (shown w) +ppTkByteArray :: SlicedByteArray -> PP ()+ppTkByteArray bs = str "# bytes" >> parens (shown $ sizeofSlicedByteArray bs)++ppTkUtf8ByteArray :: SlicedByteArray -> PP ()+ppTkUtf8ByteArray bs = str "# text" >> parens (shown $ sizeofSlicedByteArray bs)+ ppTkBytes :: S.ByteString -> PP () ppTkBytes bs = str "# bytes" >> parens (shown (S.length bs)) ppTkBytesBegin :: PP () ppTkBytesBegin = str "# bytes(*)" >> inc 3 >> indef pprint -ppTkString :: T.Text -> PP ()+ppTkString :: T.Text -> PP () ppTkString t = str "# text" >> parens (shown t) ppTkStringBegin:: PP ()@@ -250,7 +297,7 @@ ppTkBreak :: PP () ppTkBreak = str "# break" -ppTkTag :: Word -> PP ()+ppTkTag :: Word -> PP () ppTkTag w = do str "# tag" parens (shown w)@@ -258,12 +305,23 @@ pprint dec 3 +ppTkTag64 :: Word64 -> PP ()+ppTkTag64 w = do+ str "# tag"+ parens (shown w)+ inc 3+ pprint+ dec 3+ ppTkBool :: Bool -> PP () ppTkBool True = str "# bool" >> parens (str "true") ppTkBool False = str "# bool" >> parens (str "false") ppTkNull :: PP () ppTkNull = str "# null"++ppTkUndef :: PP ()+ppTkUndef = str "# undefined" ppTkSimple :: Word8 -> PP () ppTkSimple w = str "# simple" >> parens (shown w)