From 20f6b6b5b2d895632ea02980e08f74d71f0bca40 Mon Sep 17 00:00:00 2001 From: Adithya Kumar Date: Tue, 17 Dec 2024 12:35:40 +0530 Subject: [PATCH] Update docs encouraging the use of before over nilM --- core/src/Streamly/Internal/Data/Stream/Exception.hs | 1 - core/src/Streamly/Internal/Data/Stream/Type.hs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/Streamly/Internal/Data/Stream/Exception.hs b/core/src/Streamly/Internal/Data/Stream/Exception.hs index 6f45c758d4..c8c20d955c 100644 --- a/core/src/Streamly/Internal/Data/Stream/Exception.hs +++ b/core/src/Streamly/Internal/Data/Stream/Exception.hs @@ -180,7 +180,6 @@ gbracket bef aft onExc onGC ftry action = -- -- Same as the following but more efficient due to fusion: -- --- >>> before action xs = Stream.nilM action <> xs -- >>> before action xs = Stream.concatMap (const xs) (Stream.fromEffect action) -- {-# INLINE_NORMAL before #-} diff --git a/core/src/Streamly/Internal/Data/Stream/Type.hs b/core/src/Streamly/Internal/Data/Stream/Type.hs index 0f8c4816fa..c63a722b7e 100644 --- a/core/src/Streamly/Internal/Data/Stream/Type.hs +++ b/core/src/Streamly/Internal/Data/Stream/Type.hs @@ -225,6 +225,7 @@ pattern Stream step state <- (unShare -> UnStream step state) -- | A stream that terminates without producing any output, but produces a side -- effect. -- +-- >>> nilM action = Stream.before action Stream.nil -- >>> Stream.fold Fold.toList (Stream.nilM (print "nil")) -- "nil" -- []