binary 0.7.4.0 → 0.7.5.0
raw patch · 10 files changed
+117/−316 lines, 10 filesdep ~QuickCheckPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
- Data.Binary.Get.Internal: demandInput :: Get ()
- Data.Binary.Get.Internal: skip :: Int -> Get ()
+ Data.Binary.Get.Internal: failOnEOF :: [ByteString] -> Get a
+ Data.Binary.Get.Internal: type Consume s = s -> ByteString -> Either s (ByteString, ByteString)
+ Data.Binary.Get.Internal: withInputChunks :: s -> Consume s -> ([ByteString] -> b) -> ([ByteString] -> Get b) -> Get b
Files
- benchmarks/Makefile +0/−34
- binary.cabal +4/−5
- index.html +0/−161
- src/Data/Binary/Class.hs +8/−2
- src/Data/Binary/Get.hs +24/−40
- src/Data/Binary/Get/Internal.hs +38/−23
- tests/Action.hs +25/−1
- tests/Arbitrary.hs +0/−22
- tests/Makefile +0/−20
- tests/QC.hs +18/−8
− benchmarks/Makefile
@@ -1,34 +0,0 @@-ghc := ghc-ghc-flags :=-programs := builder bench--SYSTEM_BINARY := binary-0.5.1.1--.PHONY: all-all: $(programs)--builder: Builder.hs- $(ghc) $(ghc-flags) --make -O2 Builder.hs -o $@ -fforce-recomp -i../src--get: Get.hs- $(ghc) $(ghc-flags) --make -O2 Get.hs -o $@ -fforce-recomp -i../src--system-get: Get.hs- $(ghc) $(ghc-flags) --make -O2 Get.hs -o $@ -package $(SYSTEM_BINARY)--bench: Benchmark.hs MemBench.hs CBenchmark.o- $(ghc) $(ghc-flags) --make -O2 -fliberate-case-threshold=1000 Benchmark.hs CBenchmark.o -o $@ -fforce-recomp -i../src--system-bench: Benchmark.hs MemBench.hs CBenchmark.o- $(ghc) $(ghc-flags) --make -O2 -fliberate-case-threshold=1000 Benchmark.hs CBenchmark.o -o $@ -no-user-package-conf--.PHONY: run-bench-run-bench: bench- ./bench 100--CBenchmark.o: CBenchmark.c- $(ghc) -c -optc -O3 $< -o $@--.PHONY: clean-clean:- rm -f *.o *.hi $(programs)
binary.cabal view
@@ -1,5 +1,5 @@ name: binary-version: 0.7.4.0+version: 0.7.5.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin <kolmodin@gmail.com>@@ -18,10 +18,9 @@ stability: provisional build-type: Simple cabal-version: >= 1.8-tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.2+tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.2, GHC == 7.10.1 extra-source-files:- README.md index.html docs/hcar/binary-Lb.tex- tools/derive/*.hs tests/Makefile benchmarks/Makefile+ README.md docs/hcar/binary-Lb.tex tools/derive/*.hs -- from the benchmark 'bench' extra-source-files:@@ -71,7 +70,7 @@ random>=1.0.1.0, test-framework, test-framework-quickcheck2 >= 0.3,- QuickCheck>=2.7+ QuickCheck>=2.8 -- build dependencies from using binary source rather than depending on the library build-depends: array, containers
− index.html
@@ -1,161 +0,0 @@-<?xml version="1.0" encoding="iso-8859-1"?>-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">-<head>- <title>Data.Binary - efficient, pure binary serialisation for Haskell</title>- <link rel="stylesheet" href="http://www.cse.unsw.edu.au/~dons/main.css" type="text/css" />-</head>--<body xml:lang="en" lang="en">-- <div id="content">-- <h2>Data.Binary</h2>--<table width="80%" align="center"> <tr><td>-- <h3>About</h3>- <p>- Data.Binary is a library for high performance binary serialisation- of <a href="http://haskell.org">Haskell</a> data. It uses the- <a href="http://www.cse.unsw.edu.au/~dons/fps.html"- >ByteString</a> library to achieve efficient, lazy reading and- writing of structures in binary format.- </p>-- <p>- Chris Eidhof writes on his use of Data.Binary implementing a- full-text search engine:- </p>- <pre>- "The communication with Sphinx is done using a quite low-level binary- protocol, but Data.Binary saved the day: it made it very easy for us- to decode all the binary things. Especially the use of the Get and- Put monads are a big improvement over the manual reading and keeping- track of positions, as is done in the PHP/Python clients."- </pre>-- <h3>Example</h3>- For example, to serialise an interpreter's abstract syntax tree to- binary format:-<pre><span class='keyword'>import</span> <span class='conid'>Data</span><span class='varop'>.</span><span class='conid'>Binary</span>-<span class='keyword'>import</span> <span class='conid'>Control</span><span class='varop'>.</span><span class='conid'>Monad</span>-<span class='keyword'>import</span> <span class='conid'>Codec</span><span class='varop'>.</span><span class='conid'>Compression</span><span class='varop'>.</span><span class='conid'>GZip</span>--<span class='comment'>-- A Haskell AST structure</span>-<span class='keyword'>data</span> <span class='conid'>Exp</span> <span class='keyglyph'>=</span> <span class='conid'>IntE</span> <span class='conid'>Int</span>- <span class='keyglyph'>|</span> <span class='conid'>OpE</span> <span class='conid'>String</span> <span class='conid'>Exp</span> <span class='conid'>Exp</span>- <span class='keyword'>deriving</span> <span class='conid'>Eq</span>--<span class='comment'>-- An instance of Binary to encode and decode an Exp in binary</span>-<span class='keyword'>instance</span> <span class='conid'>Binary</span> <span class='conid'>Exp</span> <span class='keyword'>where</span>- <span class='varid'>put</span> <span class='layout'>(</span><span class='conid'>IntE</span> <span class='varid'>i</span><span class='layout'>)</span> <span class='keyglyph'>=</span> <span class='varid'>put</span> <span class='layout'>(</span><span class='num'>0</span> <span class='keyglyph'>::</span> <span class='conid'>Word8</span><span class='layout'>)</span> <span class='varop'>>></span> <span class='varid'>put</span> <span class='varid'>i</span>- <span class='varid'>put</span> <span class='layout'>(</span><span class='conid'>OpE</span> <span class='varid'>s</span> <span class='varid'>e1</span> <span class='varid'>e2</span><span class='layout'>)</span> <span class='keyglyph'>=</span> <span class='varid'>put</span> <span class='layout'>(</span><span class='num'>1</span> <span class='keyglyph'>::</span> <span class='conid'>Word8</span><span class='layout'>)</span> <span class='varop'>>></span> <span class='varid'>put</span> <span class='varid'>s</span> <span class='varop'>>></span> <span class='varid'>put</span> <span class='varid'>e1</span> <span class='varop'>>></span> <span class='varid'>put</span> <span class='varid'>e2</span>- <span class='varid'>get</span> <span class='keyglyph'>=</span> <span class='keyword'>do</span> <span class='varid'>tag</span> <span class='keyglyph'><-</span> <span class='varid'>getWord8</span>- <span class='keyword'>case</span> <span class='varid'>tag</span> <span class='keyword'>of</span>- <span class='num'>0</span> <span class='keyglyph'>-></span> <span class='varid'>liftM</span> <span class='conid'>IntE</span> <span class='varid'>get</span>- <span class='num'>1</span> <span class='keyglyph'>-></span> <span class='varid'>liftM3</span> <span class='conid'>OpE</span> <span class='varid'>get</span> <span class='varid'>get</span> <span class='varid'>get</span>--<span class='comment'>-- A test expression</span>-<span class='varid'>e</span> <span class='keyglyph'>=</span> <span class='conid'>OpE</span> <span class='str'>"*"</span> <span class='layout'>(</span><span class='conid'>IntE</span> <span class='num'>7</span><span class='layout'>)</span> <span class='layout'>(</span><span class='conid'>OpE</span> <span class='str'>"/"</span> <span class='layout'>(</span><span class='conid'>IntE</span> <span class='num'>4</span><span class='layout'>)</span> <span class='layout'>(</span><span class='conid'>IntE</span> <span class='num'>2</span><span class='layout'>)</span><span class='layout'>)</span>--<span class='comment'>-- Serialise and compress with gzip, then decompress and deserialise</span>-<span class='varid'>main</span> <span class='keyglyph'>=</span> <span class='keyword'>do</span>- <span class='keyword'>let</span> <span class='varid'>t</span> <span class='keyglyph'>=</span> <span class='varid'>compress</span> <span class='layout'>(</span><span class='varid'>encode</span> <span class='varid'>e</span><span class='layout'>)</span>- <span class='varid'>print</span> <span class='varid'>t</span>- <span class='keyword'>let</span> <span class='varid'>e'</span> <span class='keyglyph'>=</span> <span class='varid'>decode</span> <span class='layout'>(</span><span class='varid'>decompress</span> <span class='varid'>t</span><span class='layout'>)</span>- <span class='varid'>print</span> <span class='layout'>(</span><span class='varid'>e</span> <span class='varop'>==</span> <span class='varid'>e'</span><span class='layout'>)</span>-</pre>-- <h3>Download</h3>-- <table width="100%"><tr valign="top">- <td><h4>stable release</h4>- <table>- <tr><td>- <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.4.2"- >binary 0.4.2</a> - </td><td>(Apr 2008)</td></tr>-- <tr><td>- <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.4.1"- >binary 0.4.1</a> - </td><td>(Oct 2007)</td></tr>-- <tr><td>- <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.4"- >binary 0.4</a> - </td><td>(Oct 2007)</td></tr>-- <tr><td>- <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3"- >binary 0.3</a> - </td><td>(Mar 2007)</td></tr>-- <tr><td>- <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3"- >binary 0.2</a> - </td><td>(Jan 2007)</td></tr>-- </table> - </td>- <td><h4>development branch</h4>- <table>- <tr><td>- darcs get <a href="http://code.haskell.org/binary"- >http://code.haskell.org/binary</a>- </td></tr>- </table>- </td> </tr> </table>-- <h3>Download</h3>- <ul>- <li>- <a href="http://hackage.haskell.org/packages/archive/binary/0.4.1/doc/html/Data-Binary.html">Documentation</a>- </li>- </ul>-- <h3>Project Activity</h3>-- <center>- <img src="http://www.cse.unsw.edu.au/~dons/images/commits/community/binary-commits.png"- alt="binary commit statistics" />- </center>-- <h3>Starring...</h3>-- The Binary Strike Force- <ul>- <li>Lennart Kolmodin </li>- <li>Duncan Coutts </li>- <li>Don Stewart </li>- <li>Spencer Janssen </li>- <li>David Himmelstrup </li>- <li>Björn Bringert </li>- <li>Ross Paterson </li>- <li>Einar Karttunen </li>- <li>John Meacham </li>- <li>Ulf Norell </li>- <li>Bryan O'Sullivan </li>- <li>Tomasz Zielonka </li>- <li>Florian Weimer </li>- <li>Judah Jacobson </li>- </ul>--</td></tr> </table>--<img src="http://xmonad.org/images/HPC.badge.jpg" alt="covered by HPC" />-<img src="http://xmonad.org/images/cabal.png" alt="built with Cabal" />-<img src="http://xmonad.org/images/quickcheck.png" alt="tested with QuickCheck" />-- </div>--- <div id="footer">-Mon Jul 14 11:37:21 PDT 2008- </div>--</body>-</html>
src/Data/Binary/Class.hs view
@@ -537,11 +537,17 @@ instance Binary Double where put d = put (decodeFloat d)- get = liftM2 encodeFloat get get+ get = do+ x <- get+ y <- get+ return $! encodeFloat x y instance Binary Float where put f = put (decodeFloat f)- get = liftM2 encodeFloat get get+ get = do+ x <- get+ y <- get+ return $! encodeFloat x y ------------------------------------------------------------------------ -- Trees
src/Data/Binary/Get.hs view
@@ -360,59 +360,43 @@ Partial k -> k Nothing Fail _ _ _ -> r +-- | Skip ahead @n@ bytes. Fails if fewer than @n@ bytes are available.+skip :: Int -> Get ()+skip n = withInputChunks (fromIntegral n) consumeBytes (const ()) failOnEOF+ -- | An efficient get method for lazy ByteStrings. Fails if fewer than @n@ -- bytes are left in the input. getLazyByteString :: Int64 -> Get L.ByteString-getLazyByteString n0 = L.fromChunks <$> go n0- where- consume n str- | fromIntegral (B.length str) >= n = Right (B.splitAt (fromIntegral n) str)- | otherwise = Left (fromIntegral (B.length str))- go n = do- str <- get- case consume n str of- Left used -> do- put B.empty- demandInput- fmap (str:) (go (n - used))- Right (want,rest) -> do- put rest- return [want]+getLazyByteString n0 = withInputChunks n0 consumeBytes L.fromChunks failOnEOF +consumeBytes :: Consume Int64+consumeBytes n str+ | fromIntegral (B.length str) >= n = Right (B.splitAt (fromIntegral n) str)+ | otherwise = Left (n - fromIntegral (B.length str))++consumeUntilNul :: Consume ()+consumeUntilNul _ str =+ case B.break (==0) str of+ (want, rest) | B.null rest -> Left ()+ | otherwise -> Right (want, B.drop 1 rest)++consumeAll :: Consume ()+consumeAll _ _ = Left ()++resumeOnEOF :: [B.ByteString] -> Get L.ByteString+resumeOnEOF = return . L.fromChunks+ -- | Get a lazy ByteString that is terminated with a NUL byte. -- The returned string does not contain the NUL byte. Fails -- if it reaches the end of input without finding a NUL. getLazyByteStringNul :: Get L.ByteString-getLazyByteStringNul = L.fromChunks <$> go- where- findNull str =- case B.break (==0) str of- (want,rest) | B.null rest -> Nothing- | otherwise -> Just (want, B.drop 1 rest)- go = do- str <- get- case findNull str of- Nothing -> do- put B.empty- demandInput- fmap (str:) go- Just (want,rest) -> do- put rest- return [want]+getLazyByteStringNul = withInputChunks () consumeUntilNul L.fromChunks failOnEOF -- | Get the remaining bytes as a lazy ByteString. -- Note that this can be an expensive function to use as it forces reading -- all input and keeping the string in-memory. getRemainingLazyByteString :: Get L.ByteString-getRemainingLazyByteString = L.fromChunks <$> go- where- go = do- str <- get- put B.empty- done <- isEmpty- if done- then return [str]- else fmap (str:) go+getRemainingLazyByteString = withInputChunks () consumeAll L.fromChunks resumeOnEOF ------------------------------------------------------------------------ -- Primtives
src/Data/Binary/Get/Internal.hs view
@@ -16,13 +16,16 @@ , readNWith -- * Parsing- , skip , bytesRead , isolate++ -- * With input chunks+ , withInputChunks+ , Consume+ , failOnEOF , get , put- , demandInput , ensureN -- * Utility@@ -168,15 +171,18 @@ Done _ _ -> r prompt :: B.ByteString -> Decoder a -> (B.ByteString -> Decoder a) -> Decoder a-prompt inp kf ks =- let loop =- Partial $ \sm ->- case sm of- Just s | B.null s -> loop- | otherwise -> ks (inp `B.append` s)- Nothing -> kf- in loop+prompt inp kf ks = prompt' kf (\inp' -> ks (inp `B.append` inp')) +prompt' :: Decoder a -> (B.ByteString -> Decoder a) -> Decoder a+prompt' kf ks =+ let loop =+ Partial $ \sm ->+ case sm of+ Just s | B.null s -> loop+ | otherwise -> ks s+ Nothing -> kf+ in loop+ -- | Get the total number of bytes read to this point. bytesRead :: Get Int64 bytesRead = C $ \inp k -> BytesRead (fromIntegral $ B.length inp) (k inp)@@ -216,16 +222,24 @@ go n (BytesRead r resume) = go n (resume $! fromIntegral n0 - fromIntegral n - r) --- | Demand more input. If none available, fail.-demandInput :: Get ()-demandInput = C $ \inp ks ->- prompt inp (Fail inp "demandInput: not enough bytes") (\inp' -> ks inp' ())+type Consume s = s -> B.ByteString -> Either s (B.ByteString, B.ByteString) --- | Skip ahead @n@ bytes. Fails if fewer than @n@ bytes are available.-skip :: Int -> Get ()-skip n = readN n (const ())-{-# INLINE skip #-}+withInputChunks :: s -> Consume s -> ([B.ByteString] -> b) -> ([B.ByteString] -> Get b) -> Get b+withInputChunks initS consume onSucc onFail = go initS []+ where+ go state acc = C $ \inp ks ->+ case consume state inp of+ Left state' -> do+ let acc' = inp : acc+ prompt'+ (runCont (onFail (reverse acc')) B.empty ks)+ (\str' -> runCont (go state' acc') str' ks)+ Right (want,rest) -> do+ ks rest (onSucc (reverse (want:acc))) +failOnEOF :: [B.ByteString] -> Get a+failOnEOF bs = C $ \_ _ -> Fail (B.concat bs) "not enough bytes"+ -- | Test whether all input has been consumed, i.e. there are no remaining -- undecoded bytes. isEmpty :: Get Bool@@ -384,13 +398,14 @@ ensureN !n0 = C $ \inp ks -> do if B.length inp >= n0 then ks inp ()- else runCont (go n0) inp ks+ else runCont (withInputChunks n0 enoughChunks onSucc onFail >>= put) inp ks where -- might look a bit funny, but plays very well with GHC's inliner. -- GHC won't inline recursive functions, so we make ensureN non-recursive- go n = C $ \inp ks -> do- if B.length inp >= n- then ks inp ()- else runCont (demandInput >> go n) inp ks+ enoughChunks n str+ | B.length str >= n = Right (str,B.empty)+ | otherwise = Left (n - B.length str)+ onSucc = B.concat+ onFail bss = C $ \_ _ -> Fail (B.concat bss) "not enough bytes" {-# INLINE ensureN #-} unsafeReadN :: Int -> (B.ByteString -> a) -> Get a
tests/Action.hs view
@@ -23,6 +23,8 @@ data Action = Actions [Action] | GetByteString Int+ | GetByteStringL Int+ | Skip Int | Isolate Int [Action] | Try [Action] [Action] | Label String [Action]@@ -43,6 +45,8 @@ BytesRead -> [] Fail -> [] GetByteString n -> [ GetByteString n' | n' <- shrink n ]+ GetByteStringL n -> [ GetByteStringL n' | n' <- shrink n ]+ Skip n -> [ Skip n' | n' <- shrink n ] Isolate n as -> nub $ Actions as : [ Isolate n' as' | (n',as') <- shrink (n,as) , n' >= 0@@ -76,6 +80,8 @@ BytesRead -> max_len xs Fail -> 0 GetByteString n -> n + max_len xs+ GetByteStringL n -> n + max_len xs+ Skip n -> n + max_len xs Isolate n xs' | Just _ <- actual_len' [Isolate n xs'] -> n + max_len xs | otherwise -> n@@ -212,7 +218,7 @@ step :: Int -> Int -> [String] -> [Action] -> Eval step inp n lbls xs | inp - n < 0 =- let msg = "demandInput: not enough bytes"+ let msg = "not enough bytes" in EFail FRTooMuch (msg:lbls) inp | otherwise = go (inp-n) lbls xs go :: Int -> [String] -> [Action] -> Eval@@ -223,6 +229,8 @@ BytesRead -> go inp lbls xs Fail -> EFail FRFail ("fail":lbls) inp GetByteString n -> step inp n lbls xs+ GetByteStringL n -> step inp n lbls xs+ Skip n -> step inp n lbls xs Isolate n xs' | n > inp -> case go inp lbls xs' of@@ -281,6 +289,18 @@ "execute(getByteString): actual /= expected at pos " ++ show pos ++ ", got: " ++ show actual ++ ", expected: " ++ show expected go (pos+n) xs+ GetByteStringL n -> do+ -- Run the operation in the Get monad...+ actual <- L.toStrict <$> Binary.getLazyByteString (fromIntegral n)+ let expected = B.take n . B.drop pos $ inp+ -- ... and compare that we got what we expected.+ when (actual /= expected) $ error $+ "execute(getLazyByteString): actual /= expected at pos " ++ show pos +++ ", got: " ++ show actual ++ ", expected: " ++ show expected+ go (pos+n) xs+ Skip n -> do+ Binary.skip n+ go (pos+n) xs BytesRead -> do pos' <- Binary.bytesRead if pos == fromIntegral pos'@@ -332,6 +352,10 @@ go _ 0 = return [] go inTry s = oneof $ [ do n <- choose (0,10) (:) (GetByteString n) <$> go inTry (s-1)+ , do n <- choose (0,10)+ (:) (GetByteStringL n) <$> go inTry (s-1)+ , do n <- choose (0,10)+ (:) (Skip n) <$> go inTry (s-1) , do (:) BytesRead <$> go inTry (s-1) , do t1 <- go True (s `div` 2) t2 <- go inTry (s `div` 2)
tests/Arbitrary.hs view
@@ -1,10 +1,6 @@ {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} -#if MIN_VERSION_base(4,8,0)-#define HAS_NATURAL-#endif- module Arbitrary where import Test.QuickCheck@@ -12,10 +8,6 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L -#ifdef HAS_NATURAL-import Numeric.Natural-#endif- instance Arbitrary L.ByteString where arbitrary = fmap L.fromChunks arbitrary @@ -61,17 +53,3 @@ (a,b,c,d,e) <- arbitrary (f,g,h,i,j) <- arbitrary return (a,b,c,d,e,f,g,h,i,j)---#ifdef HAS_NATURAL--- | Generates a natural number. The number must be positive--- and its maximum value depends on the size parameter.-arbitrarySizedNatural :: Gen Natural-arbitrarySizedNatural =- sized $ \n0 ->- let n = toInteger n0 in- inBounds fromInteger (choose (0, n*n))--inBounds :: Integral a => (Integer -> a) -> Gen Integer -> Gen a-inBounds fi g = fmap fi (g `suchThat` (\x -> toInteger (fi x) == x))-#endif
− tests/Makefile
@@ -1,20 +0,0 @@-ghc := ghc-ghc-flags := --all: compiled--interpreted:- runhaskell QC.hs 1000--compiled:- $(ghc) --make -fhpc -O QC.hs -o qc -fforce-recomp -threaded -rtsopts -i../src -XCPP -package test-framework -package test-framework-quickcheck2 $(ghc-flags)- rm -f qc.tix- ./qc --maximum-generated-tests=1000 -j2 +RTS -N2--hugs:- runhugs -98 QC.hs --clean:- rm -f *.o *.hi qc *.tix *~--.PHONY: clean
tests/QC.hs view
@@ -16,16 +16,16 @@ import Data.Ratio import System.IO.Unsafe +#ifdef HAS_NATURAL+import Numeric.Natural+#endif+ import Test.Framework import Test.Framework.Providers.QuickCheck2 import Test.QuickCheck import qualified Action (tests)-import Arbitrary (-#ifdef HAS_NATURAL- arbitrarySizedNatural-#endif- )+import Arbitrary () import Data.Binary import Data.Binary.Get import Data.Binary.Put@@ -358,10 +358,20 @@ ------------------------------------------------------------------------ #ifdef HAS_NATURAL--- | Until the QuickCheck library implements instance Arbitrary Natural,--- we need this test. prop_test_Natural :: Property-prop_test_Natural = forAll arbitrarySizedNatural test+prop_test_Natural = forAll (gen :: Gen Natural) test+ where+ gen :: Gen Natural+ gen = do+ b <- arbitrary+ if b+ then do+ x <- arbitrarySizedNatural :: Gen Natural+ -- arbitrarySizedNatural generates numbers smaller than+ -- (maxBound :: Word64), so let's make them bigger to better test+ -- the Binary instance.+ return (x + fromIntegral (maxBound :: Word64))+ else arbitrarySizedNatural #endif ------------------------------------------------------------------------