on master help sign in
GHC-9: Use Fuse annotation in writeLastN to fuse it
commit7af237fa4d05abc4b42a276ac330efd94ce52abe authorHarendra Kumar <harendra@composewell.com> dateSat 22 Jan 2022, 02:25 (5 years ago) parentba5d328
2 files changed+14−5
src/Streamly/Internal/Data/Array/Foreign.hs+5−5 src/Streamly/Internal/Data/Tuple/Strict.hs+9
src/Streamly/Internal/Data/Array/Foreign.hs+5−5
@@ -136,7 +136,7 @@ import Streamly.Internal.Data.Array.Foreign.Type (Array(..), length)
136136import Streamly.Internal.Data.Fold.Type (Fold(..))
137137import Streamly.Internal.Data.Producer.Type (Producer(..))
138138import Streamly.Internal.Data.Stream.Serial (SerialT(..))
139−import Streamly.Internal.Data.Tuple.Strict (Tuple3'(..))
139+import Streamly.Internal.Data.Tuple.Strict (Tuple3Fused'(..))
140140import Streamly.Internal.Data.Unfold.Type (Unfold(..))
141141import Streamly.Internal.System.IO (unsafeInlineIO)
142142
@@ -302,15 +302,15 @@ writeLastN n
302302
303303 where
304304
305− step (Tuple3' rb rh i) a = do
305+ step (Tuple3Fused' rb rh i) a = do
306306 rh1 <- liftIO $ RB.unsafeInsert rb rh a
307− return $ FL.Partial $ Tuple3' rb rh1 (i + 1)
307+ return $ FL.Partial $ Tuple3Fused' rb rh1 (i + 1)
308308
309309 initial =
310− let f (a, b) = FL.Partial $ Tuple3' a b (0 :: Int)
310+ let f (a, b) = FL.Partial $ Tuple3Fused' a b (0 :: Int)
311311 in fmap f $ liftIO $ RB.new n
312312
313− done (Tuple3' rb rh i) = do
313+ done (Tuple3Fused' rb rh i) = do
314314 arr <- liftIO $ MA.newArray n
315315 foldFunc i rh snoc' arr rb
316316
src/Streamly/Internal/Data/Tuple/Strict.hs+9
@@ -21,15 +21,24 @@ module Streamly.Internal.Data.Tuple.Strict
2121 (
2222 Tuple' (..)
2323 , Tuple3' (..)
24+ , Tuple3Fused' (..)
2425 , Tuple4' (..)
2526 )
2627where
2728
29+import Fusion.Plugin.Types (Fuse(..))
30+
2831-- | A strict '(,)'
2932data Tuple' a b = Tuple' !a !b deriving Show
3033
34+-- XXX Add TupleFused'
35+
3136-- | A strict '(,,)'
37+{-# ANN type Tuple3Fused' Fuse #-}
3238data Tuple3' a b c = Tuple3' !a !b !c deriving Show
3339
40+-- | A strict '(,,)'
41+data Tuple3Fused' a b c = Tuple3Fused' !a !b !c deriving Show
42+
3443-- | A strict '(,,,)'
3544data Tuple4' a b c d = Tuple4' !a !b !c !d deriving Show