@@ -186,16 +186,22 @@ instance IsStream SerialT where
186186instance Monad m => Monad (SerialT m) where
187187 return = pure
188188
189+ -- Benchmarks better with StreamD bind and pure:
190+ -- toList, filterAllout, *>, *<, >> (~2x)
191+ --
192+ -- pure = SerialT . D.fromStreamD . D.yield
193+ -- m >>= f = D.fromStreamD $ D.concatMap (D.toStreamD . f) (D.toStreamD m)
194+
195+ -- Benchmarks better with CPS bind and pure:
196+ -- Prime sieve (25x)
197+ -- n binds, breakAfterSome, filterAllIn, state transformer (~2x)
198+ --
189199 {-# INLINE (>>=) #-}
190200 (>>=) = K.bindWith K.serial
191201
192202 {-# INLINE (>>) #-}
193203 (>>) = (*>)
194204
195− -- StreamD based implementation
196− -- return = SerialT . D.fromStreamD . D.yield
197− -- m >>= f = D.fromStreamD $ D.concatMap (\a -> D.toStreamD (f a)) (D.toStreamD m)
198−
199205------------------------------------------------------------------------------
200206-- Other instances
201207------------------------------------------------------------------------------