From 741ed848782ed05654b4fca3253c1c6d3a7f2af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20L=C3=A4ll?= Date: Sat, 4 Mar 2023 15:23:42 +0200 Subject: [PATCH 1/2] Remove EOL spaces --- src/Streaming/Prelude.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Streaming/Prelude.hs b/src/Streaming/Prelude.hs index d6969b1..f927e6f 100644 --- a/src/Streaming/Prelude.hs +++ b/src/Streaming/Prelude.hs @@ -834,7 +834,7 @@ elem_ a' = loop False where It is the same as @S.iterate succ@. Because their return type is polymorphic, @enumFrom@, @enumFromThen@ and @iterate@ are useful with functions like @zip@ and @zipWith@, which - require the zipped streams to have the same return type. + require the zipped streams to have the same return type. For example, with @each [1..]@ the following bit of connect-and-resume would not compile: @@ -1390,7 +1390,7 @@ mapM_ f = loop where {- | Map layers of one functor to another with a transformation involving the base monad. - + This function is completely functor-general. It is often useful with the more concrete type @ From 20b3f0c0512a5a33f16cc9b3ca233a4e17b366e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20L=C3=A4ll?= Date: Sat, 4 Mar 2023 14:10:26 +0200 Subject: [PATCH 2/2] Use `forever` for `repeatM` --- src/Streaming/Prelude.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Streaming/Prelude.hs b/src/Streaming/Prelude.hs index f927e6f..0ddd00f 100644 --- a/src/Streaming/Prelude.hs +++ b/src/Streaming/Prelude.hs @@ -1706,11 +1706,8 @@ two -} repeatM :: Monad m => m a -> Stream (Of a) m r -repeatM ma = loop where - loop = do - a <- lift ma - yield a - loop +repeatM ma = forever (lift ma >>= yield) + {-# INLINABLE repeatM #-} -- ---------------