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

Lack of whileM, whileM_, untilM and untilM_ methods for Monad #1569

Closed
Atry opened this issue Mar 22, 2017 · 5 comments
Closed

Lack of whileM, whileM_, untilM and untilM_ methods for Monad #1569

Atry opened this issue Mar 22, 2017 · 5 comments
Assignees

Comments

@Atry
Copy link
Contributor

Atry commented Mar 22, 2017

These methods present in scalaz.Monad. Should we add them in cats as well?

@kailuowang
Copy link
Contributor

Forgive my ignorance ( I never used these before), I am just curious is there any usecases for this other than the MonadState, in particular, MonadState[StateT[Trampoline, S, ?], S (with Stack safety) or MonadState[State[S, ?], S] (without) .

@peterneyens
Copy link
Collaborator

There is this closed PR #1216 by @tpolecat (from before the move of tailRecM to FlatMap).

@tpolecat
Copy link
Member

@kailuowang these can be useful for IO-like types, or things that will be interpreted into IO … in doobie for instance get[Foo].whileM[Vector](next) is a program of type Free[ResultSetOp, Vector[Foo]] that expresses the intent to read a resultset into a vector.

I closed that PR because I lost interest in the tailRecM discussion, but it should be straightforward to implement now.

@Atry
Copy link
Contributor Author

Atry commented Mar 23, 2017

@kailuowang I am porting ThoughtWorks Each to cats.

At the moment, ThoughtWorks Each requires whileM_ on scalaz.Monad in order to transform do and while loops.

I will be able to transform do and while loops on cats, if cats support whileM_ , too.

@johnynek
Copy link
Contributor

johnynek commented Mar 23, 2017 via email

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

5 participants