on master help sign in
change fromListM to fromFoldable, add a rewrite rule for serial streams
commit6e513737d5a093b9483fb9427180f723d478ceb3 authorAnurag Hooda <anuraghooda@composewell.com> dateThu 14 Jan 2021, 16:17 (6 years ago) parent4d1e39d
1 file changed+6−1
src/Streamly/Internal/Data/Stream/IsStream/Generate.hs+6−1
src/Streamly/Internal/Data/Stream/IsStream/Generate.hs+6−1
@@ -506,10 +506,15 @@ fromFoldableM = Prelude.foldr consM K.nil
506506-- @since 0.4.0
507507{-# INLINE_EARLY fromListM #-}
508508fromListM :: (MonadAsync m, IsStream t) => [m a] -> t m a
509−fromListM = fromStreamD . D.fromListM
509+fromListM = fromFoldableM
510510{-# RULES "fromListM fallback to StreamK" [1]
511511 forall a. D.toStreamK (D.fromListM a) = fromFoldableM a #-}
512512
513+{-# RULES "fromListM serial" fromListM = fromListMSerial #-}
514+{-# INLINE_EARLY fromListMSerial #-}
515+fromListMSerial :: MonadAsync m => [m a] -> SerialT m a
516+fromListMSerial = fromStreamD . D.fromListM
517+
513518-- | Same as 'fromFoldable'.
514519--
515520-- @since 0.1.0