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 polymorphic improve variant #22

Open
treeowl opened this issue Dec 28, 2015 · 1 comment
Open

Add polymorphic improve variant #22

treeowl opened this issue Dec 28, 2015 · 1 comment

Comments

@treeowl
Copy link
Contributor

treeowl commented Dec 28, 2015

improve :: Functor f => (forall m. MonadFree f m => m a) -> Free f a
improve m = lowerCodensity m

lowerCodensity :: Monad f => Codensity f a -> f a

The basic idea of improve is that the passed action does not depend on the choice of free monad construction (I don't actually remember why this matters, but that's the idea). The specific choice of Free f as the result monad, however, seems to be arbitrary. Thus

improve' :: (Functor f, MonadFree f m') =>
            (forall m . MonadFree f m => m a) -> m' a
improve' m = lowerCodensity m
@treeowl
Copy link
Contributor Author

treeowl commented Dec 28, 2015

Unrelated: why improve m = lowerCodensity m and not just improve = lowerCodensity?

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

1 participant