on master help sign in
GHC-9: Use Fuse annotation in writeLastN to fuse it
7af237fHarendra Kumar
src/Streamly/Internal/Data/Array/Foreign.hs+5−5
@@ -136,7 +136,7 @@ import Streamly.Internal.Data.Array.Foreign.Type (Array(..), length)
136import Streamly.Internal.Data.Fold.Type (Fold(..))
136import Streamly.Internal.Data.Fold.Type (Fold(..))
137import Streamly.Internal.Data.Producer.Type (Producer(..))
137import Streamly.Internal.Data.Producer.Type (Producer(..))
138import Streamly.Internal.Data.Stream.Serial (SerialT(..))
138import Streamly.Internal.Data.Stream.Serial (SerialT(..))
139−import Streamly.Internal.Data.Tuple.Strict (Tuple3'(..))
139+import Streamly.Internal.Data.Tuple.Strict (Tuple3Fused'(..))
140import Streamly.Internal.Data.Unfold.Type (Unfold(..))
140import Streamly.Internal.Data.Unfold.Type (Unfold(..))
141import Streamly.Internal.System.IO (unsafeInlineIO)
141import Streamly.Internal.System.IO (unsafeInlineIO)
142
142
@@ -302,15 +302,15 @@ writeLastN n
302
302
303 where
303 where
304
304
305− step (Tuple3' rb rh i) a = do
305+ step (Tuple3Fused' rb rh i) a = do
306 rh1 <- liftIO $ RB.unsafeInsert rb rh a
306 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)
308
308
309 initial =
309 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)
311 in fmap f $ liftIO $ RB.new n
311 in fmap f $ liftIO $ RB.new n
312
312
313− done (Tuple3' rb rh i) = do
313+ done (Tuple3Fused' rb rh i) = do
314 arr <- liftIO $ MA.newArray n
314 arr <- liftIO $ MA.newArray n
315 foldFunc i rh snoc' arr rb
315 foldFunc i rh snoc' arr rb
316
316
src/Streamly/Internal/Data/Tuple/Strict.hs+9
@@ -21,15 +21,24 @@ module Streamly.Internal.Data.Tuple.Strict
21 (
21 (
22 Tuple' (..)
22 Tuple' (..)
23 , Tuple3' (..)
23 , Tuple3' (..)
24+ , Tuple3Fused' (..)
24 , Tuple4' (..)
25 , Tuple4' (..)
25 )
26 )
26where
27where
27
28
29+import Fusion.Plugin.Types (Fuse(..))
30+
28-- | A strict '(,)'
31-- | A strict '(,)'
29data Tuple' a b = Tuple' !a !b deriving Show
32data Tuple' a b = Tuple' !a !b deriving Show
30
33
34+-- XXX Add TupleFused'
35+
31-- | A strict '(,,)'
36-- | A strict '(,,)'
37+{-# ANN type Tuple3Fused' Fuse #-}
32data Tuple3' a b c = Tuple3' !a !b !c deriving Show
38data Tuple3' a b c = Tuple3' !a !b !c deriving Show
33
39
40+-- | A strict '(,,)'
41+data Tuple3Fused' a b c = Tuple3Fused' !a !b !c deriving Show
42+
34-- | A strict '(,,,)'
43-- | A strict '(,,,)'
35data Tuple4' a b c d = Tuple4' !a !b !c !d deriving Show
44data Tuple4' a b c d = Tuple4' !a !b !c !d deriving Show