@@ -10,6 +10,7 @@
1010-- consists of an accumulator and an effectful action that absorbs a value into
1111-- the accumulator.
1212--
13+-- >>> import Data.Function ((&))
1314-- >>> import qualified Streamly.Data.Fold as Fold
1415-- >>> import qualified Streamly.Prelude as Stream
1516--
@@ -99,24 +100,26 @@
99100-- Streams are producers, transformations on streams happen on the output side:
100101--
101102-- >>> :{
102−-- f =
103−-- Stream.filter odd
103+-- f stream =
104+-- Stream.filter odd stream
104105-- & Stream.map (+1)
105106-- & Stream.sum
106107-- :}
107−-- >>> f $ Stream.fromList [1..100]
108+--
109+-- >>> f $ Stream.fromList [1..100 :: Int]
108110-- 2550
109111--
110112-- Folds are stream consumers with an input stream and an output value, stream
111113-- transformations on folds happen on the input side:
112114--
113115-- >>> :{
114−-- f =
115−-- Fold.filter odd
116+-- f stream =
117+-- Fold.filter odd stream
116118-- $ Fold.lmap (+1)
117119-- $ Fold.sum
118120-- :}
119−-- >>> Stream.fold f $ Stream.fromList [1..100]
121+--
122+-- >>> Stream.fold f $ Stream.fromList [1..100 :: Int]
120123-- 2550
121124--
122125-- Notice the similiarity in the definition of @f@ in both cases, the only
@@ -275,5 +278,6 @@ import Prelude
275278import Streamly.Internal.Data.Fold
276279
277280-- $setup
281+-- >>> import Data.Function ((&))
278282-- >>> import qualified Streamly.Data.Fold as Fold
279283-- >>> import qualified Streamly.Prelude as Stream