on master help sign in
Add some explanatory notes to Unfold/Fold types.
commit239cff3606375fa5e6057c3917c2ec4e7ca6fde2 authorHarendra Kumar <harendra@composewell.com> dateSun 22 Aug 2021, 04:41 (5 years ago) parentd5a8ebe
2 files changed+8
src/Streamly/Internal/Data/Fold/Type.hs+4 src/Streamly/Internal/Data/Unfold/Type.hs+4
src/Streamly/Internal/Data/Fold/Type.hs+4
@@ -350,6 +350,10 @@ mapMStep f res =
350350-- The Fold type
351351------------------------------------------------------------------------------
352352
353+-- An fold is akin to a writer. It is the streaming equivalent of a writer.
354+-- The type @b@ is the accumulator of the writer. That's the reason the
355+-- default folds in various modules are called "write".
356+
353357-- | The type @Fold m a b@ having constructor @Fold step initial extract@
354358-- represents a fold over an input stream of values of type @a@ to a final
355359-- value of type @b@ in 'Monad' @m@.
src/Streamly/Internal/Data/Unfold/Type.hs+4
@@ -85,6 +85,10 @@ import Prelude hiding (map, concatMap, zipWith, takeWhile)
8585-- The order of arguments allows 'Category' and 'Arrow' instances but precludes
8686-- contravariant and contra-applicative.
8787--
88+-- An unfold is akin to a reader. It is the streaming equivalent of a reader.
89+-- The argument @a@ is the environment of the reader. That's the reason the
90+-- default unfolds in various modules are called "read".
91+--
8892-- | An @Unfold m a b@ is a generator of a stream of values of type @b@ from a
8993-- seed of type 'a' in 'Monad' @m@.
9094--