@@ -1381,13 +1381,24 @@ mapM_ f = loop where
13811381
13821382
13831383{- | Map layers of one functor to another with a transformation involving the base monad.
1384- This could be trivial, e.g.
1384+
1385+ This function is completely functor-general. It is often useful with the more concrete type
13851386
1386- > let noteBeginning text x = putStrLn text >> return text
1387+ @
1388+ mapped :: (forall x. Stream (Of a) IO x -> IO (Of b x)) -> Stream (Stream (Of a) IO) IO r -> Stream (Of b) IO r
1389+ @
1390+
1391+ to process groups which have been demarcated in an effectful, @IO@-based
1392+ stream by grouping functions like 'Streaming.Prelude.group',
1393+ 'Streaming.Prelude.split' or 'Streaming.Prelude.breaks'. Summary functions
1394+ like 'Streaming.Prelude.fold', 'Streaming.Prelude.foldM',
1395+ 'Streaming.Prelude.mconcat' or 'Streaming.Prelude.toList' are often used
1396+ to define the transformation argument. For example:
13871397
1388- this is completely functor-general
1398+ >>> S.toList_ $ S.mapped S.toList $ S.split 'c' (S.each "abcde")
1399+ ["ab","de"]
13891400
1390- @ maps@ and @ mapped@ obey these rules:
1401+ 'Streaming.Prelude. maps' and 'Streaming.Prelude. mapped' obey these rules:
13911402
13921403> maps id = id
13931404> mapped return = id
@@ -1396,8 +1407,9 @@ mapM_ f = loop where
13961407> maps f . mapped g = mapped (fmap f . g)
13971408> mapped f . maps g = mapped (f <=< fmap g)
13981409
1399- @maps@ is more fundamental than @mapped@, which is best understood as a convenience
1400- for effecting this frequent composition:
1410+ 'Streaming.Prelude.maps' is more fundamental than
1411+ 'Streaming.Prelude.mapped', which is best understood as a convenience for
1412+ effecting this frequent composition:
14011413
14021414> mapped phi = decompose . maps (Compose . phi)
14031415
0 commit comments