free icon indicating copy to clipboard operation
free copied to clipboard

foldFree id ≟ retract

Open Icelandjack opened this issue 10 years ago • 3 comments

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.

Icelandjack avatar Mar 09 '16 07:03 Icelandjack

Addendum: is there a name or use for

iterM wrap :: (MonadFree f m, Functor f) => Free f a -> m a

Icelandjack avatar Mar 09 '16 08:03 Icelandjack

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.

Icelandjack avatar Mar 09 '16 08:03 Icelandjack

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.

fumieval avatar Mar 09 '16 22:03 fumieval