vector-algorithms 0.7.0.4 → 0.8.0.0
raw patch · 3 files changed
+33/−31 lines, 3 filesdep −mtldep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependencies removed: mtl
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
Files
- bench/simple/Main.hs +2/−3
- tests/properties/Tests.hs +25/−23
- vector-algorithms.cabal +6/−5
bench/simple/Main.hs view
@@ -5,8 +5,8 @@ import Prelude hiding (read, length) import qualified Prelude as P +import Control.Monad import Control.Monad.ST-import Control.Monad.Error import Data.Char import Data.Ord (comparing)@@ -40,7 +40,7 @@ displayTime :: String -> Integer -> IO () displayTime s elapsed = putStrLn $- s ++ " : " ++ show (fromIntegral elapsed / 1e12) ++ " seconds"+ s ++ " : " ++ show (fromIntegral elapsed / (1e12 :: Double)) ++ " seconds" run :: String -> IO Integer -> IO () run s t = t >>= displayTime s@@ -142,7 +142,6 @@ RadixSort -> sortSuite "radix sort" g n radixSort AmericanFlagSort -> sortSuite "flag sort" g n flagSort TimSort -> sortSuite "tim sort" g n timSort- _ -> putStrLn $ "Currently unsupported algorithm: " ++ show alg mergeSort :: MVector RealWorld Int -> IO () mergeSort v = M.sort v
tests/properties/Tests.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE ImpredicativeTypes, RankNTypes, TypeOperators, FlexibleContexts #-}+{-# LANGUAGE RankNTypes, TypeOperators, FlexibleContexts #-} module Main (main) where @@ -37,36 +37,40 @@ type SizeAlgo e r = forall s mv. MVector mv e => mv s e -> Int -> ST s r type BoundAlgo e r = forall s mv. MVector mv e => mv s e -> Int -> Int -> ST s r +newtype WrappedAlgo e r = WrapAlgo { unWrapAlgo :: Algo e r }+newtype WrappedSizeAlgo e r = WrapSizeAlgo { unWrapSizeAlgo :: SizeAlgo e r }+newtype WrappedBoundAlgo e r = WrapBoundAlgo { unWrapBoundAlgo :: BoundAlgo e r }+ args = stdArgs { maxSuccess = 1000 , maxDiscardRatio = 2 } check_Int_sort = forM_ algos $ \(name,algo) ->- quickCheckWith args (label name . prop_fullsort algo)+ quickCheckWith args (label name . prop_fullsort (unWrapAlgo algo)) where- algos :: [(String, Algo Int ())]- algos = [ ("introsort", INT.sort)- , ("insertion sort", INS.sort)- , ("merge sort", M.sort)- , ("heapsort", H.sort)- , ("timsort", T.sort)+ algos :: [(String, WrappedAlgo Int ())]+ algos = [ ("introsort", WrapAlgo INT.sort)+ , ("insertion sort", WrapAlgo INS.sort)+ , ("merge sort", WrapAlgo M.sort)+ , ("heapsort", WrapAlgo H.sort)+ , ("timsort", WrapAlgo T.sort) ] check_Int_partialsort = forM_ algos $ \(name,algo) ->- quickCheckWith args (label name . prop_partialsort algo)+ quickCheckWith args (label name . prop_partialsort (unWrapSizeAlgo algo)) where- algos :: [(String, SizeAlgo Int ())]- algos = [ ("intro-partialsort", INT.partialSort)- , ("heap partialsort", H.partialSort)+ algos :: [(String, WrappedSizeAlgo Int ())]+ algos = [ ("intro-partialsort", WrapSizeAlgo INT.partialSort)+ , ("heap partialsort", WrapSizeAlgo H.partialSort) ] check_Int_select = forM_ algos $ \(name,algo) ->- quickCheckWith args (label name . prop_select algo)+ quickCheckWith args (label name . prop_select (unWrapSizeAlgo algo)) where- algos :: [(String, SizeAlgo Int ())]- algos = [ ("intro-select", INT.select)- , ("heap select", H.select)+ algos :: [(String, WrappedSizeAlgo Int ())]+ algos = [ ("intro-select", WrapSizeAlgo INT.select)+ , ("heap select", WrapSizeAlgo H.select) ] check_radix_sorts = do@@ -142,16 +146,14 @@ 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 ())-{-- qc $ label "intropartial" . prop_sized (const . prop_permutation)+ qc $ label "intropartial" . prop_sized (\x -> const (prop_permutation x)) (INT.partialSort :: SizeAlgo Int ())- qc $ label "introselect" . prop_sized (const . prop_permutation)+ qc $ label "introselect" . prop_sized (\x -> const (prop_permutation x)) (INT.select :: SizeAlgo Int ())- qc $ label "heappartial" . prop_sized (const . prop_permutation)+ qc $ label "heappartial" . prop_sized (\x -> const (prop_permutation x)) (H.partialSort :: SizeAlgo Int ())- qc $ label "heapselect" . prop_sized (const . prop_permutation)- (H.select :: Algo Int ())--}+ qc $ label "heapselect" . prop_sized (\x -> const (prop_permutation x))+ (H.select :: SizeAlgo Int ()) where qc prop = quickCheckWith args prop
vector-algorithms.cabal view
@@ -1,5 +1,5 @@ name: vector-algorithms-version: 0.7.0.4+version: 0.8.0.0 license: BSD3 license-file: LICENSE author: Dan Doel@@ -32,7 +32,7 @@ flag bench description: Build a benchmarking program to test vector-algorithms performance- default: False+ default: True flag properties description: Enable the quickcheck tests@@ -100,8 +100,9 @@ if flag(InternalChecks) cpp-options: -DVECTOR_INTERNAL_CHECKS -executable simple-bench+benchmark simple-bench hs-source-dirs: bench/simple+ type: exitcode-stdio-1.0 if !flag(bench) buildable: False@@ -111,7 +112,7 @@ other-modules: Blocks - build-depends: base, mwc-random, vector, vector-algorithms, mtl+ build-depends: base, mwc-random, vector, vector-algorithms ghc-options: -Wall -- Cabal/Hackage complains about these@@ -138,7 +139,7 @@ base, bytestring, containers,- QuickCheck >= 2,+ QuickCheck > 2.9 && < 2.12, vector, vector-algorithms