mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-10-03 19:57:08 +03:00
Add example to express foldrM in terms of foldr
This commit is contained in:
parent
84b4c91d44
commit
30c5a56ff9
@ -572,8 +572,12 @@ foldAdd f =
|
||||
-- >>> Stream.foldrM step (return False) s
|
||||
-- True
|
||||
--
|
||||
-- >>> import Control.Monad (join)
|
||||
-- >>> foldrM f z = join $ Stream.foldr f z
|
||||
--
|
||||
{-# INLINE_NORMAL foldrM #-}
|
||||
foldrM :: Monad m => (a -> m b -> m b) -> m b -> Stream m a -> m b
|
||||
-- foldrM f z = join . Streamly.Internal.Data.Stream.StreamD.Type.foldr f z
|
||||
foldrM f z (Stream step state) = go SPEC state
|
||||
where
|
||||
{-# INLINE_LATE go #-}
|
||||
|
Loading…
Reference in New Issue
Block a user