change fromListM to fromFoldable, add a rewrite rule for serial streams

This commit is contained in:
Anurag Hooda 2021-01-14 16:17:48 +05:30 committed by Harendra Kumar
parent 4d1e39de33
commit 6e513737d5

View File

@ -506,10 +506,15 @@ fromFoldableM = Prelude.foldr consM K.nil
-- @since 0.4.0
{-# INLINE_EARLY fromListM #-}
fromListM :: (MonadAsync m, IsStream t) => [m a] -> t m a
fromListM = fromStreamD . D.fromListM
fromListM = fromFoldableM
{-# RULES "fromListM fallback to StreamK" [1]
forall a. D.toStreamK (D.fromListM a) = fromFoldableM a #-}
{-# RULES "fromListM serial" fromListM = fromListMSerial #-}
{-# INLINE_EARLY fromListMSerial #-}
fromListMSerial :: MonadAsync m => [m a] -> SerialT m a
fromListMSerial = fromStreamD . D.fromListM
-- | Same as 'fromFoldable'.
--
-- @since 0.1.0