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

No Ops for tailRecM #1568

Closed
Atry opened this issue Mar 22, 2017 · 3 comments · Fixed by #1732
Closed

No Ops for tailRecM #1568

Atry opened this issue Mar 22, 2017 · 3 comments · Fixed by #1732

Comments

@Atry
Copy link
Contributor

Atry commented Mar 22, 2017

I guess we can create a FlatMapIdOps that contains tailRecM method, like what we had in ApplicativeIdOps

@diesalbla
Copy link
Contributor

diesalbla commented Mar 24, 2017

@Atry tailRecM is a method in the FlatMap type class, but AFAIK it mostly attends an implementation concern, i.e., that of avoiding stack overflows when using, say, a traverse method. I am not entirely sure as to whether a specific syntax for it would be warranted.

Of course, I could be wrong. ¿Could you provide a code example where such syntax would be useful?

@edmundnoble
Copy link
Contributor

Monadic tail recursion is just as useful as ordinary tail recursion, especially if at the use site you don't know what monad it is. People use it in user code all the time.

@Atry
Copy link
Contributor Author

Atry commented Mar 25, 2017

@diesalbla When I was porting ThoughtWorks Each to cats, I looked for whileM_ #1569 (comment) . Then I found there is a similar method tailRecM.

I guess I will use whileM_ if it presents.

aaronlevin pushed a commit to aaronlevin/cats that referenced this issue Jun 16, 2017
aaronlevin pushed a commit to aaronlevin/cats that referenced this issue Jun 16, 2017
aaronlevin pushed a commit to aaronlevin/cats that referenced this issue Jun 16, 2017
aaronlevin pushed a commit to aaronlevin/cats that referenced this issue Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants