free
free copied to clipboard
foldFree id ≟ retract
When applying foldFree id I got
foldFree id :: Monad m => Free m a -> m a
same type as
retract :: Monad m => Free m a -> m a
and at a quick glance they appear to be equal: if so should that be added as a law? I googled foldFree id and didn't find much.
Addendum: is there a name or use for
iterM wrap :: (MonadFree f m, Functor f) => Free f a -> m a
As original question, does
hoistFree id :: Functor f => Free f a -> Free f a
equal id and should it be added as a law of hoistFree.
Laws should be clarified for methods of a type class; for existing function they don't have to be.
iterM wrap is sometimes useful to transform a free monad to an other free monad. There are already conversion functions though.