These methods present in scalaz.Monad. Should we add them in cats as well?
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) .
There is this closed PR #1216 by @tpolecat (from before the move of tailRecM to FlatMap).
@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.
@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.
Now that we have tailRecM on FlatMap these methods are easy (and stack
safe).
On Wed, Mar 22, 2017 at 15:33 杨博 (Yang Bo) notifications@github.com wrote:
@kailuowang https://github.com/kailuowang I am porting ThoughtWorks Each
https://github.com/ThoughtWorksInc/each to cats.At the moment, ThoughtWorks Each https://github.com/ThoughtWorksInc/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.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/typelevel/cats/issues/1569#issuecomment-288590918,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEJduBZwMQ8nCBaumb3BEiul24GoGNBks5rocvpgaJpZM4Mk-L_
.
Most helpful comment
Now that we have tailRecM on FlatMap these methods are easy (and stack
safe).
On Wed, Mar 22, 2017 at 15:33 杨博 (Yang Bo) notifications@github.com wrote: