@@ -266,7 +266,7 @@ import Prelude
266266-- lmapM f = Unfold.many (Unfold.functionM f)
267267-- @
268268--
269−-- /Pre-release/
269+-- /Since: 0.8.0/
270270{-# INLINE_NORMAL lmapM #-}
271271lmapM :: Monad m => (a -> m c) -> Unfold m c b -> Unfold m a b
272272lmapM f (Unfold ustep uinject) = Unfold ustep (f >=> uinject)
@@ -387,6 +387,11 @@ fold (Fold fstep initial extract) (Unfold ustep inject) a = do
387387 Skip s -> go SPEC fs s
388388 Stop -> extract fs
389389
390+-- | Apply a monadic function to each element of the stream and replace it
391+-- with the output of the resulting action.
392+--
393+-- /Since: 0.8.0/
394+--
390395{-# INLINE_NORMAL mapM #-}
391396mapM :: Monad m => (b -> m c) -> Unfold m a b -> Unfold m a c
392397mapM f (Unfold ustep uinject) = Unfold step uinject
@@ -449,7 +454,8 @@ fromStreamK = Unfold step return
449454-- | Convert a stream into an 'Unfold'. Note that a stream converted to an
450455-- 'Unfold' may not be as efficient as an 'Unfold' in some situations.
451456--
452−-- /Pre-release/
457+-- /Since: 0.8.0/
458+--
453459{-# INLINE_NORMAL fromStream #-}
454460fromStream :: (K.IsStream t, Monad m) => Unfold m (t m a) a
455461fromStream = lmap K.toStream fromStreamK
@@ -491,6 +497,9 @@ consM action unf = Unfold step inject
491497 Stop -> return Stop
492498
493499-- | Convert a list of pure values to a 'Stream'
500+--
501+-- /Since: 0.8.0/
502+--
494503{-# INLINE_LATE fromList #-}
495504fromList :: Monad m => Unfold m [a] a
496505fromList = Unfold step inject
@@ -501,6 +510,9 @@ fromList = Unfold step inject
501510 step [] = return Stop
502511
503512-- | Convert a list of monadic values to a 'Stream'
513+--
514+-- /Since: 0.8.0/
515+--
504516{-# INLINE_LATE fromListM #-}
505517fromListM :: Monad m => Unfold m [m a] a
506518fromListM = Unfold step inject
@@ -516,7 +528,7 @@ fromListM = Unfold step inject
516528
517529-- | Generates a stream replicating the seed @n@ times.
518530--
519−-- /Pre-release/
531+-- /Since: 0.8.0/
520532--
521533{-# INLINE replicateM #-}
522534replicateM :: Monad m => Int -> Unfold m (m a) a
@@ -536,7 +548,7 @@ replicateM n = Unfold step inject
536548
537549-- | Generates an infinite stream repeating the seed.
538550--
539−-- /Pre-release/
551+-- /Since: 0.8.0/
540552--
541553{-# INLINE repeatM #-}
542554repeatM :: Monad m => Unfold m (m a) a
@@ -548,7 +560,7 @@ repeatM = Unfold step return
548560-- | Generates an infinite stream starting with the given seed and applying the
549561-- given function repeatedly.
550562--
551−-- /Pre-release/
563+-- /Since: 0.8.0/
552564--
553565{-# INLINE iterateM #-}
554566iterateM :: Monad m => (a -> m a) -> Unfold m (m a) a
@@ -586,6 +598,8 @@ fromIndicesM gen = Unfold step return
586598-- >>> Unfold.fold Fold.toList u [1..100]
587599-- [1,2]
588600--
601+-- /Since: 0.8.0/
602+--
589603{-# INLINE_NORMAL take #-}
590604take :: Monad m => Int -> Unfold m a b -> Unfold m a b
591605take n (Unfold step1 inject1) = Unfold step inject
@@ -602,6 +616,10 @@ take n (Unfold step1 inject1) = Unfold step inject
602616 Stop -> Stop
603617 step (_, _) = return Stop
604618
619+-- | Same as 'takeWhile' but with a monadic predicate.
620+--
621+-- /Since: 0.8.0/
622+--
605623{-# INLINE_NORMAL takeWhileM #-}
606624takeWhileM :: Monad m => (b -> m Bool) -> Unfold m a b -> Unfold m a b
607625takeWhileM f (Unfold step1 inject1) = Unfold step inject1
@@ -616,10 +634,19 @@ takeWhileM f (Unfold step1 inject1) = Unfold step inject1
616634 Skip s -> return $ Skip s
617635 Stop -> return Stop
618636
637+-- | End the stream generated by the 'Unfold' as soon as the predicate fails
638+-- on an element.
639+--
640+-- /Since: 0.8.0/
641+--
619642{-# INLINE takeWhile #-}
620643takeWhile :: Monad m => (b -> Bool) -> Unfold m a b -> Unfold m a b
621644takeWhile f = takeWhileM (return . f)
622645
646+-- | Same as 'filter' but with a monadic predicate.
647+--
648+-- /Since: 0.8.0/
649+--
623650{-# INLINE_NORMAL filterM #-}
624651filterM :: Monad m => (b -> m Bool) -> Unfold m a b -> Unfold m a b
625652filterM f (Unfold step1 inject1) = Unfold step inject1
@@ -634,13 +661,17 @@ filterM f (Unfold step1 inject1) = Unfold step inject1
634661 Skip s -> return $ Skip s
635662 Stop -> return Stop
636663
664+-- | Include only those elements that pass a predicate.
665+--
666+-- /Since: 0.8.0/
667+--
637668{-# INLINE filter #-}
638669filter :: Monad m => (b -> Bool) -> Unfold m a b -> Unfold m a b
639670filter f = filterM (return . f)
640671
641672-- | @drop n unf@ drops @n@ elements from the stream generated by @unf@.
642673--
643−-- /Pre-release/
674+-- /Since: 0.8.0/
644675--
645676{-# INLINE_NORMAL drop #-}
646677drop :: Monad m => Int -> Unfold m a b -> Unfold m a b
@@ -672,7 +703,7 @@ drop n (Unfold step inject) = Unfold step' inject'
672703-- | @dropWhileM f unf@ drops elements from the stream generated by @unf@ while
673704-- the condition holds true. The condition function @f@ is /monadic/ in nature.
674705--
675−-- /Pre-release/
706+-- /Since: 0.8.0/
676707--
677708{-# INLINE_NORMAL dropWhileM #-}
678709dropWhileM :: Monad m => (b -> m Bool) -> Unfold m a b -> Unfold m a b
@@ -706,7 +737,7 @@ dropWhileM f (Unfold step inject) = Unfold step' inject'
706737
707738-- | Similar to 'dropWhileM' but with a pure condition function.
708739--
709−-- /Pre-release/
740+-- /Since: 0.8.0/
710741--
711742{-# INLINE dropWhile #-}
712743dropWhile :: Monad m => (b -> Bool) -> Unfold m a b -> Unfold m a b