vector-algorithms 0.5.0 → 0.5.1
raw patch · 4 files changed
+26/−3 lines, 4 filesdep +bytestring
Dependencies added: bytestring
Files
- Data/Vector/Algorithms/AmericanFlag.hs +12/−0
- tests/Tests.hs +4/−1
- tests/Util.hs +5/−0
- vector-algorithms.cabal +5/−2
Data/Vector/Algorithms/AmericanFlag.hs view
@@ -27,6 +27,8 @@ import Data.Int import Data.Bits +import qualified Data.ByteString as B+ import Data.Vector.Generic.Mutable import qualified Data.Vector.Primitive.Mutable as PV @@ -163,6 +165,16 @@ index 6 n = (n `shiftR` 8) .&. 255 index 7 n = n .&. 255 index _ _ = 0+ {-# INLINE index #-}++instance Lexicographic B.ByteString where+ terminate b i = i >= B.length b+ {-# INLINE terminate #-}+ size _ = 257+ {-# INLINE size #-}+ index i b+ | i >= B.length b = 0+ | otherwise = fromIntegral (B.index b i) + 1 {-# INLINE index #-} sort :: forall e m v. (PrimMonad m, MVector v e, Lexicographic e, Ord e)
tests/Tests.hs view
@@ -14,6 +14,8 @@ import Data.Int import Data.Word +import qualified Data.ByteString as B+ import Data.Vector (Vector) import qualified Data.Vector as V @@ -88,7 +90,7 @@ qc (label "flag Int32" . prop_fullsort (AF.sort :: Algo Int32 ())) qc (label "flag Int64" . prop_fullsort (AF.sort :: Algo Int64 ())) qc (label "flag Int" . prop_fullsort (AF.sort :: Algo Int ()))--- qc (label "flag (Int, Int)" . prop_fullsort (R.sort :: Algo (Int, Int) ()))+ qc (label "flag ByteString" . prop_fullsort (AF.sort :: Algo B.ByteString ())) where qc algo = quickCheckWith args algo @@ -141,6 +143,7 @@ qc $ label "flag W32" . prop_permutation (AF.sort :: Algo Word32 ()) qc $ label "flag W64" . prop_permutation (AF.sort :: Algo Word64 ()) qc $ label "flag Word" . prop_permutation (AF.sort :: Algo Word ())+ qc $ label "flag ByteString" . prop_permutation (AF.sort :: Algo B.ByteString ()) where qc prop = quickCheckWith args prop
tests/Util.hs view
@@ -8,6 +8,8 @@ import Data.Word import Data.Int +import qualified Data.ByteString as B+ import qualified Data.Vector as V import Data.Vector.Mutable hiding (length)@@ -25,4 +27,7 @@ instance (Arbitrary e) => Arbitrary (V.Vector e) where arbitrary = fmap V.fromList arbitrary++instance Arbitrary B.ByteString where+ arbitrary = B.pack `fmap` arbitrary
vector-algorithms.cabal view
@@ -1,5 +1,5 @@ Name: vector-algorithms-Version: 0.5.0+Version: 0.5.1 License: BSD3 License-File: LICENSE Author: Dan Doel@@ -26,7 +26,10 @@ Default: False Library- Build-Depends: base >= 3 && < 5, vector >= 0.6 && < 0.8, primitive >=0.3 && <0.4+ Build-Depends: base >= 3 && < 5,+ vector >= 0.6 && < 0.8,+ primitive >=0.3 && <0.4,+ bytestring >= 0.9 && < 0.10 Exposed-Modules: Data.Vector.Algorithms.Optimal