beamable 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+18/−7 lines, 2 filesdep ~basedep ~test-frameworkdep ~test-framework-quickcheck2
Dependency ranges changed: base, test-framework, test-framework-quickcheck2
Files
- beamable.cabal +5/−5
- src/Data/Beamable/Integer.hs +13/−2
beamable.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.0+version: 0.1.0.1 -- A short (one-line) description of the package. synopsis: Generic serializer/deserializer with compact representation@@ -63,7 +63,7 @@ -- Other library packages from which modules are imported. build-depends:- base >= 4.5 && < 4.7,+ base >= 4.5 && < 4.8, blaze-builder >= 0.3, bytestring >= 0.9, ghc-prim,@@ -77,11 +77,11 @@ type: exitcode-stdio-1.0 build-depends:- test-framework >= 0.4 && < 0.7,- test-framework-quickcheck2 >= 0.2 && < 0.3,+ test-framework >= 0.4 && < 0.9,+ test-framework-quickcheck2 >= 0.2 && < 0.4, QuickCheck >= 2.4 && < 2.6, -- Copied from regular dependencies...- base >= 4.5 && < 4.7,+ base >= 4.5 && < 4.8, blaze-builder >= 0.3, bytestring >= 0.9, ghc-prim,
src/Data/Beamable/Integer.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE UnboxedTuples #-} module Data.Beamable.Integer@@ -30,7 +31,7 @@ unbeamInteger :: ByteString -> (Integer, ByteString) unbeamInteger bs- | baSize# <# 0# = (S# x#, bs'')+ | primTrue (baSize# <# 0#) = (S# x#, bs'') | otherwise = runSTRep $ \s# -> let (# s'#, mba# #) = newByteArray# baSize# s# s''# = go mba# 0# s'#@@ -42,9 +43,19 @@ !(I# x#, bs'') = first fromIntegral $ unbeamInt bs' go mba# i# s#- | i# >=# baSize# = s#+ | primTrue (i# >=# baSize#) = s# | otherwise = let !(W8# b#) = B.index bs'' (I# i#) s'# = writeWord8Array# mba# i# b# s# in go mba# (i# +# 1#) s'# {-# INLINE unbeamInteger #-}++#if MIN_VERSION_base(4,7,0)+primTrue :: Int# -> Bool+primTrue x = tagToEnum# x+-- could use isTrue#, but that will introduce extraneous error+-- checking that we don't need.+#else+primTrue :: Bool -> Bool+primTrue = id+#endif