Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecations for streamly-0.11 #70

Merged
merged 6 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .packcheck.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ cabal.project
cabal.project.user
cabal.project.Werror
default.nix
stack.yaml
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ environment:
# version.
#STACKVER: "1.6.5"
STACK_UPGRADE: "y"
RESOLVER: "nightly-2023-12-07"
RESOLVER: "lts-22.33"
STACK_ROOT: "c:\\sr"
STACK_YAML: "stack.yaml"

# ------------------------------------------------------------------------
# cabal options
Expand Down
255 changes: 207 additions & 48 deletions benchmark/Main.hs

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions cabal.project.user
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
packages: streamly-statistics.cabal

-- source-repository-package
-- type: git
-- location: https://github.com/composewell/streamly.git
-- tag: master
--
-- source-repository-package
-- type: git
-- location: https://github.com/composewell/streamly.git
-- tag: master
-- subdir: core
source-repository-package
type: git
location: https://github.com/composewell/streamly.git
tag: master

source-repository-package
type: git
location: https://github.com/composewell/streamly.git
tag: master
subdir: core

jobs: 1
22 changes: 17 additions & 5 deletions src/Streamly/Statistics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ import qualified Deque.Strict as Deque
import qualified Streamly.Data.Fold as Fold
import qualified Streamly.Data.Array as Array
import qualified Streamly.Data.MutArray as MA
import qualified Streamly.Internal.Data.MutArray as MA (unsafeSwapIndices)
import qualified Streamly.Internal.Data.MutArray as MA
(unsafeSwapIndices, unsafeGetIndex, unsafePutIndex)
import qualified Streamly.Internal.Data.Fold as Window
import qualified Streamly.Data.Stream as Stream

Expand All @@ -221,18 +222,25 @@ import Prelude hiding (length, sum, minimum, maximum)
-- Re-exports
-------------------------------------------------------------------------------

-- XXX Deprecate these once the streamly functions are released.

-- {-# DEPRECATED lmap "Use Streamly.Data.Fold.windowLmap instead" #-}
lmap :: (c -> a) -> Fold m (a, Maybe a) b -> Fold m (c, Maybe c) b
lmap = Window.windowLmap

-- {-# DEPRECATED length "Use Streamly.Data.Fold.windowLength instead" #-}
length :: (Monad m, Num b) => Fold m (a, Maybe a) b
length = Window.windowLength

-- {-# DEPRECATED sum "Use Streamly.Data.Fold.windowSum instead" #-}
sum :: (Monad m, Num a) => Fold m (a, Maybe a) a
sum = Window.windowSum

-- {-# DEPRECATED sumInt "Use Streamly.Data.Fold.windowSumInt instead" #-}
sumInt :: (Monad m, Integral a) => Fold m (a, Maybe a) a
sumInt = Window.windowSumInt

-- {-# DEPRECATED powerSum "Use Streamly.Data.Fold.windowPowerSum instead" #-}
powerSum :: (Monad m, Num a) => Int -> Fold m (a, Maybe a) a
powerSum = Window.windowPowerSum

Expand Down Expand Up @@ -326,13 +334,13 @@ fft marr
let butterfly i | i >= len = flight (j + 1) (a + e)
| otherwise = do
let i1 = i + l1
xi1 :+ yi1 <- MA.getIndexUnsafe i1 marr
xi1 :+ yi1 <- MA.unsafeGetIndex i1 marr
let !c = cos a
!s = sin a
d = (c * xi1 - s * yi1) :+ (s * xi1 + c * yi1)
ci <- MA.getIndexUnsafe i marr
MA.putIndexUnsafe i1 marr (ci - d)
MA.putIndexUnsafe i marr (ci + d)
ci <- MA.unsafeGetIndex i marr
MA.unsafePutIndex i1 marr (ci - d)
MA.unsafePutIndex i marr (ci + d)
butterfly (i + l2)
butterfly j
flight 0 0
Expand All @@ -341,6 +349,10 @@ fft marr
-- Location
-------------------------------------------------------------------------------

-- XXX prefix window to these folds and implement these using the scans. or
-- just remove these as the corresponding scans can be converted to folds. If
-- we remove these we can just export the scans through this module itself.

-- Theoretically, we can approximate minimum in a rolling window by using a
-- 'powerMean' with sufficiently large negative power.
--
Expand Down
Loading
Loading