popkey 0.1.0.0 → 0.1.0.1
raw patch · 5 files changed
+12/−9 lines, 5 filesdep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +3/−0
- popkey.cabal +1/−1
- src/PopKey/Encoding.hs +1/−1
- src/PopKey/Internal2.hs +6/−6
- test/Spec.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,8 @@ # Revision history for popkey +# 0.1.0.1+- Fix bug in sum decoding due to conflating 0 and 1-based positions+ ## 0.1.0.0 - Drop profunctor instance in exchange for keyed folding - Add Store instance
popkey.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: popkey-version: 0.1.0.0+version: 0.1.0.1 synopsis: Static key-value storage backed by poppy description: Static key-value storage backed by poppy. homepage: https://github.com/identicalsnowflake/popkey
src/PopKey/Encoding.hs view
@@ -99,7 +99,7 @@ gpkEncode (L1 x) = Sum' (Left (gpkEncode @s x)) gpkEncode (R1 x) = Sum' (Right (gpkEncode @s x)) {-# INLINE gpkDecode #-}- gpkDecode (Sum' x)= case x of+ gpkDecode (Sum' x) = case x of Left l -> L1 (gpkDecode @s l) Right r -> R1 (gpkDecode @s r)
src/PopKey/Internal2.hs view
@@ -62,10 +62,10 @@ go (Single pk) = Single' (pkIndex pk i) go (Prod x y) = Prod' (go x) (go y) go (Sum _ pk l r) = do- let b1pos = fromIntegral i + 1- if pk .?. b1pos- then Sum' (Right (rawq (fromIntegral (rank1 pk (fromIntegral b1pos) - 1)) r))- else Sum' (Left (rawq (fromIntegral (rank0 pk (fromIntegral b1pos) - 1)) l))+ let b1pos = fromIntegral i+ if pk .?. b1pos -- nasty! this uses 0-based indexing, while rank/select use 1-based indexing+ then Sum' (Right (rawq (fromIntegral (rank1 pk (fromIntegral b1pos))) r))+ else Sum' (Left (rawq (fromIntegral (rank0 pk (fromIntegral b1pos))) l)) -- returns @-1@ if not found {-# INLINABLE bin_search2 #-}@@ -123,12 +123,12 @@ v <- MUV.new l for_ (zip [ 0 .. ] zs) \(i,x) -> case x of- Left _ -> pure ()+ Left _ -> MUV.unsafeWrite v i 0 Right _ -> MUV.unsafeWrite v i 1 UV.unsafeFreeze v - uv64 :: UV.Vector Word64 = unsafeCoerce do cloneToWords bv+ uv64 :: UV.Vector Word64 = unsafeCoerce do cloneToWords $ bv sv64 :: SV.Vector Word64 = SV.convert uv64 !(ppy :: CsPoppy) = makeCsPoppy sv64
test/Spec.hs view
@@ -19,7 +19,7 @@ it "sanity checks for fixed-size data" $ property \(xs :: [ Int ]) -> toList (scode $ fmap (+1) $ makePopKey' xs) == fmap (+1) xs - it "sanity checks for fixed-size data" $ property \(xs :: [ (Int , Word8) ]) ->+ it "sanity checks for fixed-size data" $ property \(xs :: [ (Int , Maybe Word8) ]) -> toList (scode $ makePopKey' xs) == xs it "sanity checks for var-size data" $ property \(xs :: [ [ Int ] ]) ->