packages feed

sampling 0.1.1 → 0.2.0

raw patch · 2 files changed

+8/−8 lines, 2 filesdep ~basedep ~foldldep ~mwc-randomPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, foldl, mwc-random, primitive, vector

API changes (from Hackage documentation)

- Numeric.Sampling: sample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m (Maybe (Vector a))
+ Numeric.Sampling: sample :: (PrimMonad m, Foldable f) => Int -> f a -> Gen (PrimState m) -> m (Maybe [a])
- Numeric.Sampling: sampleIO :: Foldable f => Int -> f a -> IO (Maybe (Vector a))
+ Numeric.Sampling: sampleIO :: Foldable f => Int -> f a -> IO (Maybe [a])

Files

lib/Numeric/Sampling.hs view
@@ -29,7 +29,7 @@ #endif import           Data.Function               (on) import           Data.List                   (sortBy)-import           Data.Vector                 (Vector)+import qualified Data.Vector                 as V (toList) import           Numeric.Sampling.Internal import           System.Random.MWC @@ -39,14 +39,14 @@ --   being sampled from. sample   :: (PrimMonad m, Foldable f)-  => Int -> f a -> Gen (PrimState m) -> m (Maybe (Vector a))+  => Int -> f a -> Gen (PrimState m) -> m (Maybe [a]) sample n xs gen   | n < 0     = return Nothing-  | otherwise = F.foldM (randomN n gen) xs+  | otherwise = fmap (fmap V.toList) (F.foldM (randomN n gen) xs) {-# INLINABLE sample #-}  -- | (/O(n)/) 'sample' specialized to IO.-sampleIO :: Foldable f => Int -> f a -> IO (Maybe (Vector a))+sampleIO :: Foldable f => Int -> f a -> IO (Maybe [a]) sampleIO n xs = do   gen <- createSystemRandom   sample n xs gen
sampling.cabal view
@@ -1,5 +1,5 @@ name:                sampling-version:             0.1.1+version:             0.2.0 synopsis:            Sample values from collections. homepage:            https://github.com/jtobin/sampling license:             MIT@@ -34,10 +34,10 @@       Numeric.Sampling   build-depends:       base        < 5-    , foldl-    , mwc-random+    , foldl       >= 1.1 && < 2+    , mwc-random  >= 0.13 && < 0.14     , primitive-    , vector+    , vector      >= 0.11 && < 0.12  executable sampling-test   hs-source-dirs: src