-- | Lift a natural transformation from @f@ to @g@ into a natural transformation from @'Free' f@ to @'Free' g@.
hoistFree :: Functor g => (forall a. f a -> g a) -> Free f b -> Free g b
-- | Lift a monad homomorphism from @m@ to @n@ into a monad homomorphism from @'FreeT' f m@ to @'FreeT' f n@
--
-- @'hoistFreeT' :: ('Functor' m, 'Functor' f) => (m ~> n) -> 'FreeT' f m ~> 'FreeT' f n@
hoistFreeT :: (Functor m, Functor f) => (forall a. m a -> n a) -> FreeT f m b -> FreeT f n b
-- | Lift a natural transformation from @f@ to @g@ into a monad homomorphism from @'FreeT' f m@ to @'FreeT' g m@
transFreeT :: (Monad m, Functor g) => (forall a. f a -> g a) -> FreeT f m b -> FreeT g m b
Both hoistFree and transFreeT correspond to lifting a natural transformation f ⇒ g to a monad homomorphism Free f ⇒ Free g, just like you'd lift a function a → b to a monoid homomorphism [a] → [b]. hoistFreeT is specific to monad transformers.
hoistFree should be deprecated and renamed to transFree, and its comment should mention that it lifts a natural transformation to a monad homomorphism.
Same thing with hoistF/hoistFT/transFT and possibly others.
Both
hoistFree
andtransFreeT
correspond to lifting a natural transformationf ⇒ g
to a monad homomorphismFree f ⇒ Free g
, just like you'd lift a functiona → b
to a monoid homomorphism[a] → [b]
.hoistFreeT
is specific to monad transformers.hoistFree
should be deprecated and renamed totransFree
, and its comment should mention that it lifts a natural transformation to a monad homomorphism.Same thing with
hoistF
/hoistFT
/transFT
and possibly others.