hw-balancedparens 0.3.0.3 → 0.3.0.4
raw patch · 8 files changed
+33/−51 lines, 8 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hw-balancedparens.cabal +1/−7
- src/HaskellWorks/Data/BalancedParens/RangeMin.hs +10/−14
- src/HaskellWorks/Data/BalancedParens/RangeMin2.hs +12/−20
- test/HaskellWorks/Data/BalancedParens/Internal/BroadwordSpec.hs +2/−2
- test/HaskellWorks/Data/BalancedParens/Internal/ParensSeqSpec.hs +2/−2
- test/HaskellWorks/Data/BalancedParens/RangeMin2Spec.hs +2/−2
- test/HaskellWorks/Data/BalancedParens/RangeMinSpec.hs +2/−2
- test/HaskellWorks/Data/BalancedParens/SimpleSpec.hs +2/−2
hw-balancedparens.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: hw-balancedparens-version: 0.3.0.3+version: 0.3.0.4 synopsis: Balanced parentheses description: Balanced parentheses. category: Data, Bit, Succinct Data Structures, Data Structures@@ -90,9 +90,7 @@ , hw-prim , vector exposed-modules: HaskellWorks.Data.BalancedParens.Gen- Paths_hw_balancedparens hs-source-dirs: gen- autogen-modules: Paths_hw_balancedparens test-suite hw-balancedparens-test import: base, config@@ -113,10 +111,8 @@ HaskellWorks.Data.BalancedParens.RangeMin2Spec HaskellWorks.Data.BalancedParens.RangeMinSpec HaskellWorks.Data.BalancedParens.SimpleSpec- Paths_hw_balancedparens hs-source-dirs: test ghc-options: -threaded -rtsopts -with-rtsopts=-N- autogen-modules: Paths_hw_balancedparens build-tool-depends: hspec-discover:hspec-discover benchmark bench@@ -130,8 +126,6 @@ , vector type: exitcode-stdio-1.0 main-is: Main.hs- other-modules: Paths_hw_balancedparens- autogen-modules: Paths_hw_balancedparens hs-source-dirs: bench test-suite doctest
src/HaskellWorks/Data/BalancedParens/RangeMin.hs view
@@ -87,23 +87,23 @@ lenL0 = lenBP lenL1 = (DVS.length rmL0Min `div` pageSizeL1) + 1 :: Int lenL2 = (DVS.length rmL0Min `div` pageSizeL2) + 1 :: Int- allMinL0 = dvsConstructNI lenL0 (\i -> if i == lenBP then MinExcess (-64) (-64) else minExcess1 (bpv !!! fromIntegral i))- allMinL1 = dvsConstructNI lenL1 (\i -> minExcess1 (dropTake (i * pageSizeL1) pageSizeL1 bpv))- allMinL2 = dvsConstructNI lenL2 (\i -> minExcess1 (dropTake (i * pageSizeL2) pageSizeL2 bpv))+ allMinL0 = DVS.generate lenL0 (\i -> if i == lenBP then MinExcess (-64) (-64) else minExcess1 (bpv !!! fromIntegral i))+ allMinL1 = DVS.generate lenL1 (\i -> minExcess1 (dropTake (i * pageSizeL1) pageSizeL1 bpv))+ allMinL2 = DVS.generate lenL2 (\i -> minExcess1 (dropTake (i * pageSizeL2) pageSizeL2 bpv)) -- Note: (0xffffffffffffffc0 :: Int64) = -64- rmL0Excess = dvsConstructNI lenL0 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL0 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL1Excess = dvsConstructNI lenL1 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL1 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL2Excess = dvsConstructNI lenL2 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL2 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL0Min = dvsConstructNI lenL0 (\i -> let MinExcess minE _ = allMinL0 DVS.! i in fromIntegral minE)- rmL1Min = dvsConstructNI lenL1 (\i -> let MinExcess minE _ = allMinL1 DVS.! i in fromIntegral minE)- rmL2Min = dvsConstructNI lenL2 (\i -> let MinExcess minE _ = allMinL2 DVS.! i in fromIntegral minE)+ rmL0Excess = DVS.generate lenL0 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL0 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL1Excess = DVS.generate lenL1 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL1 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL2Excess = DVS.generate lenL2 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL2 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL0Min = DVS.generate lenL0 (\i -> let MinExcess minE _ = allMinL0 DVS.! i in fromIntegral minE)+ rmL1Min = DVS.generate lenL1 (\i -> let MinExcess minE _ = allMinL1 DVS.! i in fromIntegral minE)+ rmL2Min = DVS.generate lenL2 (\i -> let MinExcess minE _ = allMinL2 DVS.! i in fromIntegral minE) dropTake :: DVS.Storable a => Int -> Int -> DVS.Vector a -> DVS.Vector a dropTake n o = DVS.take o . DVS.drop n {-# INLINE dropTake #-} dvsReword :: (DVS.Storable a, Integral a, DVS.Storable b, Num b) => DVS.Vector a -> DVS.Vector b-dvsReword v = dvsConstructNI (DVS.length v) (\i -> fromIntegral (v DVS.! i))+dvsReword v = DVS.generate (DVS.length v) (\i -> fromIntegral (v DVS.! i)) {-# INLINE dvsReword #-} pageFill :: DVS.Storable a => Int -> Int -> a -> DVS.Vector a -> DVS.Vector a@@ -115,10 +115,6 @@ let len = DVS.length r in if len == o then r else DVS.concat [r, DVS.fromList (replicate (o - len) a)] {-# INLINE dropTakeFill #-}--dvsConstructNI :: DVS.Storable a => Int -> (Int -> a) -> DVS.Vector a-dvsConstructNI n g = DVS.constructN n (g . DVS.length)-{-# INLINE dvsConstructNI #-} data FindState = FindBP | FindL0 | FindFromL0
src/HaskellWorks/Data/BalancedParens/RangeMin2.hs view
@@ -113,18 +113,18 @@ lenL2 = (DVS.length rmL0Min `div` pageSizeL2) + 1 :: Int lenL3 = (DVS.length rmL0Min `div` pageSizeL3) + 1 :: Int lenL4 = (DVS.length rmL0Min `div` pageSizeL4) + 1 :: Int- allMinL0 = dvConstructNI lenL0 (\i -> if i == lenBP then MinExcess (-64) (-64) else minExcess1 (bpv !!! fromIntegral i))+ allMinL0 = DV.generate lenL0 (\i -> if i == lenBP then MinExcess (-64) (-64) else minExcess1 (bpv !!! fromIntegral i)) -- Note: (0xffffffffffffffc0 :: Int64) = -64- rmL0Excess = dvsConstructNI lenL0 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL0 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL1Excess = dvsConstructNI lenL1 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL1 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL2Excess = dvsConstructNI lenL2 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL2 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL3Excess = dvsConstructNI lenL3 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL3 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL4Excess = dvsConstructNI lenL4 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL4 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16- rmL0Min = dvsConstructNI lenL0 (\i -> let MinExcess minE _ = allMinL0 DV.! i in fromIntegral minE) :: DVS.Vector Int16- rmL1Min = dvsConstructNI lenL1 (\i -> genMin 0 (pageFill i factorL1 0 rmL0Min) (pageFill i factorL1 0 rmL0Excess))- rmL2Min = dvsConstructNI lenL2 (\i -> genMin 0 (pageFill i factorL2 0 rmL1Min) (pageFill i factorL2 0 rmL1Excess))- rmL3Min = dvsConstructNI lenL3 (\i -> genMin 0 (pageFill i factorL3 0 rmL2Min) (pageFill i factorL3 0 rmL2Excess))- rmL4Min = dvsConstructNI lenL4 (\i -> genMin 0 (pageFill i factorL4 0 rmL3Min) (pageFill i factorL4 0 rmL3Excess))+ rmL0Excess = DVS.generate lenL0 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL0 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL1Excess = DVS.generate lenL1 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL1 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL2Excess = DVS.generate lenL2 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL2 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL3Excess = DVS.generate lenL3 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL3 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL4Excess = DVS.generate lenL4 (\i -> fromIntegral (allExcess1 (pageFill i pageSizeL4 0xffffffffffffffc0 bpv))) :: DVS.Vector Int16+ rmL0Min = DVS.generate lenL0 (\i -> let MinExcess minE _ = allMinL0 DV.! i in fromIntegral minE) :: DVS.Vector Int16+ rmL1Min = DVS.generate lenL1 (\i -> genMin 0 (pageFill i factorL1 0 rmL0Min) (pageFill i factorL1 0 rmL0Excess))+ rmL2Min = DVS.generate lenL2 (\i -> genMin 0 (pageFill i factorL2 0 rmL1Min) (pageFill i factorL2 0 rmL1Excess))+ rmL3Min = DVS.generate lenL3 (\i -> genMin 0 (pageFill i factorL3 0 rmL2Min) (pageFill i factorL3 0 rmL2Excess))+ rmL4Min = DVS.generate lenL4 (\i -> genMin 0 (pageFill i factorL4 0 rmL3Min) (pageFill i factorL4 0 rmL3Excess)) genMin :: (Integral a, DVS.Storable a) => a -> DVS.Vector a -> DVS.Vector a -> a genMin mL mins excesses = if not (DVS.null mins) || not (DVS.null excesses)@@ -141,16 +141,8 @@ if rLen == s then r else DVS.concat [r, DVS.replicate (s - rLen) a] {-# INLINE dropTakeFill #-} -dvConstructNI :: Int -> (Int -> a) -> DV.Vector a-dvConstructNI n g = DV.constructN n (g . DV.length)-{-# INLINE dvConstructNI #-}--dvsConstructNI :: DVS.Storable a => Int -> (Int -> a) -> DVS.Vector a-dvsConstructNI n g = DVS.constructN n (g . DVS.length)-{-# INLINE dvsConstructNI #-}- dvsReword :: (DVS.Storable a, Integral a, DVS.Storable b, Num b) => DVS.Vector a -> DVS.Vector b-dvsReword v = dvsConstructNI (DVS.length v) (\i -> fromIntegral (v DVS.! i))+dvsReword v = DVS.generate (DVS.length v) (\i -> fromIntegral (v DVS.! i)) {-# INLINE dvsReword #-} dvsLastOrZero :: (DVS.Storable a, Integral a) => DVS.Vector a -> a
test/HaskellWorks/Data/BalancedParens/Internal/BroadwordSpec.hs view
@@ -20,8 +20,8 @@ import qualified Hedgehog.Gen as G import qualified Hedgehog.Range as R -{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: Ignore Reduce duplication" :: String) #-}+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} newtype ShowVector a = ShowVector a deriving (Eq, BitShow, Generic)
test/HaskellWorks/Data/BalancedParens/Internal/ParensSeqSpec.hs view
@@ -18,8 +18,8 @@ import qualified Hedgehog.Gen as G import qualified Hedgehog.Range as R -{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: Ignore Reduce duplication" :: String) #-}+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} spec :: Spec spec = describe "HaskellWorks.Data.BalancedParens.Internal.ParensSeqSpec" $ do
test/HaskellWorks/Data/BalancedParens/RangeMin2Spec.hs view
@@ -16,8 +16,8 @@ import qualified Data.Vector.Storable as DVS -{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: Ignore Reduce duplication" :: String) #-}+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} newtype ShowVector a = ShowVector a deriving (Eq, BitShow, Generic)
test/HaskellWorks/Data/BalancedParens/RangeMinSpec.hs view
@@ -22,8 +22,8 @@ import qualified Hedgehog.Gen as G import qualified Hedgehog.Range as R -{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: Ignore Reduce duplication" :: String) #-}+{-# ANN module ("ignore Redundant do" :: String) #-}+{-# ANN module ("ignore Reduce duplication" :: String) #-} newtype ShowVector a = ShowVector a deriving (Eq, BitShow, Generic)
test/HaskellWorks/Data/BalancedParens/SimpleSpec.hs view
@@ -17,8 +17,8 @@ import qualified Hedgehog.Gen as G import qualified Hedgehog.Range as R -{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}-{-# ANN module ("HLint: Ignore Reduce duplication" :: String) #-}+{-# ANN module ("HLint: ignore Redundant do" :: String) #-}+{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-} spec :: Spec spec = describe "HaskellWorks.Data.BalancedParens.SimpleSpec" $ do