perfect-vector-shuffle 0.1.1 → 0.1.1.1
raw patch · 4 files changed
+70/−31 lines, 4 filesdep ~MonadRandomdep ~basedep ~primitivenew-component:exe:examplePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: MonadRandom, base, primitive, random, vector
API changes (from Hackage documentation)
Files
- CHANGELOG.md +12/−1
- perfect-vector-shuffle.cabal +33/−29
- src/Example.hs +24/−0
- test/Immutable/Test.hs +1/−1
CHANGELOG.md view
@@ -1,2 +1,13 @@-0.1.0+Changelog+========== +## [0.1.1] - 2019-07-18++* Added sample without replacement, maximal cycle and derangement functions+* Added test coverage for all new functionality+* Added example executable++## [0.1.0] - 2019-05-02++* Added Fisher--Yates shuffle algorithms+* Added test suite
perfect-vector-shuffle.cabal view
@@ -4,7 +4,7 @@ name: perfect-vector-shuffle synopsis: Library for performing vector shuffles-version: 0.1.1+version: 0.1.1.1 author: Callan McGill maintainer: callan.mcgill@gmail.com@@ -14,8 +14,8 @@ license: BSD-3-Clause description: .- This package contains functions for performing in-place Fisher--Yates - shuffles on mutable and immutable vectors along with some related + This package contains functions for performing in-place Fisher--Yates+ shuffles on mutable and immutable vectors along with some related functionality. The shuffles are uniform at random amongst all permuations. .@@ -75,11 +75,11 @@ ghc-options: -Wall -fexpose-all-unfoldings- -fspecialize-aggressively+ -fspecialise-aggressively - build-depends: base ^>= 4.12.0.0+ build-depends: base >= 4.9 && < 4.14 , MonadRandom >= 0.5.1.1 && < 0.6- , primitive >= 0.6.4.0 && < 0.7+ , primitive ^>= 0.7 , random ^>= 1.1 , vector >= 0.12.0 && < 0.13 @@ -101,12 +101,12 @@ ghc-options: -Wall -fexpose-all-unfoldings- -fspecialize-aggressively+ -fspecialise-aggressively -Wincomplete-patterns - build-depends: perfect-vector-shuffle ^>= 0.1.1- , base ^>= 4.12.0.0- , QuickCheck ^>= 2.12.6.1+ build-depends: perfect-vector-shuffle ^>= 0.1.1.1+ , base >= 4.9 && < 4.14+ , QuickCheck ^>= 2.13.2 , random ^>= 1.1 , tasty >= 1.2 && < 1.3 , tasty-quickcheck ^>= 0.10@@ -119,22 +119,26 @@ default-language: Haskell2010 ---Executable example------ main-is: Example.hs------ hs-source-dirs: src------ ghc-options: -Wall--- -fexpose-all-unfoldings--- -fspecialize-aggressively--- -Wincomplete-patterns------ build-depends: perfect-vector-shuffle ^>= 0.1.1--- , base ^>= 4.12.0--- , MonadRandom >= 0.5.1.1 && < 0.6--- , primitive >= 0.6.4.0 && < 0.7--- , random ^>= 1.1--- , vector >= 0.12.0 && < 0.13------ default-language: Haskell2010+Executable example++ main-is: Example.hs++ hs-source-dirs: src++ ghc-options: -Wall+ -fexpose-all-unfoldings+ -fspecialize-aggressively+ -Wincomplete-patterns++ build-depends: perfect-vector-shuffle ^>= 0.1.1.1+ , base >= 4.9 && < 4.14+ , MonadRandom >= 0.5.1.1 && < 0.6+ , primitive ^>= 0.7+ , random ^>= 1.1+ , vector >= 0.12.0 && < 0.13++ other-modules: Immutable.Shuffle+ Mutable.Shuffle+ ++ default-language: Haskell2010
+ src/Example.hs view
@@ -0,0 +1,24 @@+module Main where++import Data.Vector+import Immutable.Shuffle++main :: IO ()+main = do+{+shuffleMyVector >>= print;+cycleMyVector >>= print;+derangeMyVector >>= print;+}++myVector :: Vector Int+myVector = fromList [1..10]++shuffleMyVector :: IO (Vector Int)+shuffleMyVector = shuffleM myVector++cycleMyVector :: IO (Vector Int)+cycleMyVector = maximalCycleM myVector++derangeMyVector :: IO (Vector Int)+derangeMyVector = derangementM myVector
test/Immutable/Test.hs view
@@ -123,7 +123,7 @@ isDerangementM :: Positive Int -> PropertyM IO Property isDerangementM (Positive n) = do- v <- run $ derangementM (V.fromList [0.. n])+ v <- run $ derangementM (V.fromList [0..n]) let perm = V.indexed v let unmoved = V.filter (uncurry (==)) perm pure $ null unmoved === True