@@ -410,9 +410,9 @@ module Streamly.Internal.Data.Fold.Type
410410 , close
411411 , isClosed
412412
413− -- * Lifting inner monad
414− , hoist
415− , generally
413+ -- * Transforming inner monad
414+ , morphInner
415+ , generalizeInner
416416
417417 -- * Deprecated
418418 , foldr
@@ -440,6 +440,7 @@ import Prelude hiding (concatMap, filter, foldr, map, take)
440440-- $setup
441441-- >>> :m
442442-- >>> :set -XFlexibleContexts
443+-- >>> import Data.Functor.Identity (runIdentity)
443444-- >>> import Data.Maybe (fromJust, isJust)
444445-- >>> import Data.Monoid (Endo(..))
445446-- >>> import Streamly.Data.Fold (Fold)
@@ -1824,20 +1825,20 @@ refold (Refold step inject extract) f =
18241825 Fold step (extractM f >>= inject) extract
18251826
18261827------------------------------------------------------------------------------
1827−-- hoist
1828+-- morphInner
18281829------------------------------------------------------------------------------
18291830
1830−-- | Change the underlying monad of a fold
1831+-- | Change the underlying monad of a fold. Also known as hoist.
18311832--
18321833-- /Pre-release/
1833−hoist :: (forall x. m x -> n x) -> Fold m a b -> Fold n a b
1834−hoist f (Fold step initial extract) =
1834+morphInner :: (forall x. m x -> n x) -> Fold m a b -> Fold n a b
1835+morphInner f (Fold step initial extract) =
18351836 Fold (\x a -> f $ step x a) (f initial) (f . extract)
18361837
1837−-- | Adapt a pure fold to any monad
1838+-- | Adapt a pure fold to any monad.
18381839--
1839−-- >>> generally = Fold.hoist (return . runIdentity)
1840+-- >>> generalizeInner = Fold.morphInner (return . runIdentity)
18401841--
18411842-- /Pre-release/
1842−generally :: Monad m => Fold Identity a b -> Fold m a b
1843−generally = hoist (return . runIdentity)
1843+generalizeInner :: Monad m => Fold Identity a b -> Fold m a b
1844+generalizeInner = morphInner (return . runIdentity)