on master help sign in
Deprecate variance and stdDev in folds
0d2ce6cAdithya Kumar
benchmark/Streamly/Benchmark/Data/Fold.hs+1
@@ -8,6 +8,7 @@
8{-# LANGUAGE FlexibleContexts #-}
8{-# LANGUAGE FlexibleContexts #-}
9{-# LANGUAGE RankNTypes #-}
9{-# LANGUAGE RankNTypes #-}
10{-# LANGUAGE ScopedTypeVariables #-}
10{-# LANGUAGE ScopedTypeVariables #-}
11+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
11
12
12module Main (main) where
13module Main (main) where
13
14
core/src/Streamly/Data/Fold.hs+2−2
@@ -162,8 +162,6 @@ module Streamly.Data.Fold
162 , minimumBy
162 , minimumBy
163 , minimum
163 , minimum
164 , mean
164 , mean
165− , variance
166− , stdDev
167 , rollingHash
165 , rollingHash
168 , rollingHashWithSalt
166 , rollingHashWithSalt
169
167
@@ -270,6 +268,8 @@ module Streamly.Data.Fold
270 -- * Deprecated
268 -- * Deprecated
271 , sequence
269 , sequence
272 , mapM
270 , mapM
271+ , variance
272+ , stdDev
273 )
273 )
274where
274where
275
275
core/src/Streamly/Internal/Data/Fold.hs+4−2
@@ -57,8 +57,6 @@ module Streamly.Internal.Data.Fold
57 , countDistinct
57 , countDistinct
58 , countDistinctInt
58 , countDistinctInt
59 , mean
59 , mean
60− , variance
61− , stdDev
62 , rollingHash
60 , rollingHash
63 , rollingHashWithSalt
61 , rollingHashWithSalt
64 , rollingHashFirstN
62 , rollingHashFirstN
@@ -285,6 +283,8 @@ module Streamly.Internal.Data.Fold
285 -- * Deprecated
283 -- * Deprecated
286 , sequence
284 , sequence
287 , mapM
285 , mapM
286+ , variance
287+ , stdDev
288 )
288 )
289where
289where
290
290
@@ -794,6 +794,7 @@ mean = fmap done $ foldl' step begin
794-- the input stream.
794-- the input stream.
795--
795--
796-- @since 0.7.0
796-- @since 0.7.0
797+{-# DEPRECATED variance "Use the streamly-statistics package instead" #-}
797{-# INLINE variance #-}
798{-# INLINE variance #-}
798variance :: (Monad m, Fractional a) => Fold m a a
799variance :: (Monad m, Fractional a) => Fold m a a
799variance = fmap done $ foldl' step begin
800variance = fmap done $ foldl' step begin
@@ -817,6 +818,7 @@ variance = fmap done $ foldl' step begin
817-- elements in the input stream.
818-- elements in the input stream.
818--
819--
819-- @since 0.7.0
820-- @since 0.7.0
821+{-# DEPRECATED stdDev "Use the streamly-statistics package instead" #-}
820{-# INLINE stdDev #-}
822{-# INLINE stdDev #-}
821stdDev :: (Monad m, Floating a) => Fold m a a
823stdDev :: (Monad m, Floating a) => Fold m a a
822stdDev = sqrt <$> variance
824stdDev = sqrt <$> variance
docs/User/ProjectRelated/Changelog.md+7
@@ -8,6 +8,13 @@
8 readChunksWithBufferOf -> readChunksWith
8 readChunksWithBufferOf -> readChunksWith
9 writeWithBufferOf -> writeWith
9 writeWithBufferOf -> writeWith
10 writeChunksWithBufferOf -> writeChunksWith
10 writeChunksWithBufferOf -> writeChunksWith
11+
12+### Deprecations
13+
14+* In `Streamly.Data.Fold`:
15+ * `variance`, and `stdDev` have been deprecated. Please use the
16+ `streamly-statistics` package instead.
17+
11## 0.8.2 (Mar 2022)
18## 0.8.2 (Mar 2022)
12
19
13* Fix performance issues for GHC-9. These changes coupled with GHC changes
20* Fix performance issues for GHC-9. These changes coupled with GHC changes
test/Streamly/Test/Data/Fold.hs+2
@@ -1,3 +1,5 @@
1+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
2+
1module Main (main) where
3module Main (main) where
2
4
3import Data.List (sort)
5import Data.List (sort)