@@ -410,9 +410,9 @@ module Streamly.Internal.Data.Fold.Type
411 , isClosed
411 , isClosed
413− -- * Lifting inner monad
413+ -- * Transforming inner monad
414− , hoist
414+ , morphInner
415− , generally
415+ , generalizeInner
417 -- * Deprecated
417 -- * Deprecated
@@ -440,6 +440,7 @@ import Prelude hiding (concatMap, filter, foldr, map, take)
442-- >>> :set -XFlexibleContexts
442-- >>> :set -XFlexibleContexts
443+-- >>> import Data.Functor.Identity (runIdentity)
443-- >>> import Data.Maybe (fromJust, isJust)
444-- >>> import Data.Maybe (fromJust, isJust)
444-- >>> import Data.Monoid (Endo(..))
445-- >>> import Data.Monoid (Endo(..))
445-- >>> import Streamly.Data.Fold (Fold)
446-- >>> import Streamly.Data.Fold (Fold)
@@ -1824,20 +1825,20 @@ refold (Refold step inject extract) f =
1824 Fold step (extractM f >>= inject) extract
1825 Fold step (extractM f >>= inject) extract
1826------------------------------------------------------------------------------
1827------------------------------------------------------------------------------
1827−-- hoist
1828+-- morphInner
1828------------------------------------------------------------------------------
1829------------------------------------------------------------------------------
1830−-- | Change the underlying monad of a fold
1831+-- | Change the underlying monad of a fold. Also known as hoist.
1832-- /Pre-release/
1833-- /Pre-release/
1833−hoist :: (forall x. m x -> n x) -> Fold m a b -> Fold n a b
1834+morphInner :: (forall x. m x -> n x) -> Fold m a b -> Fold n a b
1834−hoist f (Fold step initial extract) =
1835+morphInner f (Fold step initial extract) =
1835 Fold (\x a -> f $ step x a) (f initial) (f . extract)
1836 Fold (\x a -> f $ step x a) (f initial) (f . extract)
1837−-- | Adapt a pure fold to any monad
1838+-- | Adapt a pure fold to any monad.
1839−-- >>> generally = Fold.hoist (return . runIdentity)
1840+-- >>> generalizeInner = Fold.morphInner (return . runIdentity)
1841-- /Pre-release/
1842-- /Pre-release/
1842−generally :: Monad m => Fold Identity a b -> Fold m a b
1843+generalizeInner :: Monad m => Fold Identity a b -> Fold m a b
1843−generally = hoist (return . runIdentity)
1844+generalizeInner = morphInner (return . runIdentity)