Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add foldFree? #78

Closed
Gabriella439 opened this issue Oct 13, 2014 · 2 comments
Closed

Add foldFree? #78

Gabriella439 opened this issue Oct 13, 2014 · 2 comments

Comments

@Gabriella439
Copy link
Contributor

Would you be okay with adding this function?

foldFree :: (Functor m, Monad m) => (forall x . f x -> m x) -> Free f a -> m a
foldFree nat = retract . hoistFree nat

As you already know, this is basically one of the isomorphisms in the adjunction that defines the free monad. You have iterM, which is pretty close, but sometimes I find myself reaching for the above signature.

ekmett added a commit that referenced this issue Mar 6, 2015
@ekmett
Copy link
Owner

ekmett commented Mar 6, 2015

Done.

@ekmett ekmett closed this as completed Mar 6, 2015
@Gabriella439
Copy link
Contributor Author

Awesome! Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants