-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Could forever
be Applicative f => f a -> Void
instead?
#327
Comments
Hi @aleator! We reexport However, I totally understand your concern. It would be really nice to prevent such situations from happening. I will refer to the following blog post that explains best-practices around specifying types for infinite loops: Main idea, is that if your function returns infinite loop, its type should be something like forever :: Applicative f => f a -> f void You can notice, that this is the same as the original type signature, just with a slightly different variable name: forever :: Applicative f => f a -> f b Thus being said, it is probably a good idea to replace But what you can do to solve this problem, is to introduce a custom helper function that expects an infinite action: asyncInfinite :: IO Void -> IO (Async Void)
asyncInfinite = async And this would probably be a good function to be added to |
I concede on the point of not causing surprises and this issue may be closed. However, doesn't the article mentioned justify using the type variable version only with the convenience of not having to say But, how would you guys feel about introducing |
@aleator I agree with you that if you already have I don't mind having a different function besides |
@chshersh If good name is only thing required before I can make a pull request, then here are some suggestions. Maybe the good name is not on the list, but perhaps it will spark an idea:
None seem to have obvious word conflicts. Any favourites? |
I agree that this function would be helpful to have! My options are:
|
Hi @vrom911! After thinking about these, I'd think Further, I'd vote for not putting it into an Extra module, but to always export it. How would you feel about adding the hlint to move people away from |
@aleator , sounds good to me. I think we can add it in the |
This addresses kowainik#327. However, I couldn't regenerate .hlint.yaml due to dhall version mismatch.
* Add 'infinitely' to 'Relude.Monad' This addresses #327. However, I couldn't regenerate .hlint.yaml due to dhall version mismatch. * Drop trailing whitespace Co-authored-by: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com> * Update src/Relude/Monad.hs Co-authored-by: Dmitrii Kovanikov <kovanikov@gmail.com> * Update CHANGELOG.md Co-authored-by: Dmitrii Kovanikov <kovanikov@gmail.com> * Update CHANGELOG.md Co-authored-by: Dmitrii Kovanikov <kovanikov@gmail.com> Co-authored-by: Dmitrii Kovanikov <kovanikov@gmail.com> Co-authored-by: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com>
Just asking, since
vs.
seems like common error for less attentive guys like me.
The text was updated successfully, but these errors were encountered: