Deprecate variance and stdDev in folds

This commit is contained in:
Adithya Kumar 2022-06-05 02:45:20 +05:30
parent f81f8b5bf3
commit 0d2ce6ca76
5 changed files with 16 additions and 4 deletions

View File

@ -8,6 +8,7 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
module Main (main) where

View File

@ -162,8 +162,6 @@ module Streamly.Data.Fold
, minimumBy
, minimum
, mean
, variance
, stdDev
, rollingHash
, rollingHashWithSalt
@ -270,6 +268,8 @@ module Streamly.Data.Fold
-- * Deprecated
, sequence
, mapM
, variance
, stdDev
)
where

View File

@ -57,8 +57,6 @@ module Streamly.Internal.Data.Fold
, countDistinct
, countDistinctInt
, mean
, variance
, stdDev
, rollingHash
, rollingHashWithSalt
, rollingHashFirstN
@ -285,6 +283,8 @@ module Streamly.Internal.Data.Fold
-- * Deprecated
, sequence
, mapM
, variance
, stdDev
)
where
@ -794,6 +794,7 @@ mean = fmap done $ foldl' step begin
-- the input stream.
--
-- @since 0.7.0
{-# DEPRECATED variance "Use the streamly-statistics package instead" #-}
{-# INLINE variance #-}
variance :: (Monad m, Fractional a) => Fold m a a
variance = fmap done $ foldl' step begin
@ -817,6 +818,7 @@ variance = fmap done $ foldl' step begin
-- elements in the input stream.
--
-- @since 0.7.0
{-# DEPRECATED stdDev "Use the streamly-statistics package instead" #-}
{-# INLINE stdDev #-}
stdDev :: (Monad m, Floating a) => Fold m a a
stdDev = sqrt <$> variance

View File

@ -8,6 +8,13 @@
readChunksWithBufferOf -> readChunksWith
writeWithBufferOf -> writeWith
writeChunksWithBufferOf -> writeChunksWith
### Deprecations
* In `Streamly.Data.Fold`:
* `variance`, and `stdDev` have been deprecated. Please use the
`streamly-statistics` package instead.
## 0.8.2 (Mar 2022)
* Fix performance issues for GHC-9. These changes coupled with GHC changes

View File

@ -1,3 +1,5 @@
{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
module Main (main) where
import Data.List (sort)