We're currently missing listen from Writer and local from Reader.
Here's an easy implementation:
def listen[A](fa: ReaderWriterStateT[M, E, L, S, A]): ReaderWriterStateT[M, E, L, S, (A, L)] =
ReaderWriterStateT((e, s) => fa.run(e, s).map {
case (l, s, a) => (l, s, (a, l))
})
def local[A](f: E => E)(fa: ReaderWriterStateT[M, E, L, S, A]): ReaderWriterStateT[M, E, L, S, A] =
ReaderWriterStateT((e, s) => fa.run(f(e), s))
You're spoiling the fun with these easy implementations!
Speaking of listen, we should add that one to WriterT as well:
def listen[A, L](w: WriterT[F, L, A]): WriterT[F, L, (A, L)] =
WriterT(F.map(w.run) {
case (l, a) => (l, a -> l)
})
Hi @LukaJCB I wouldn't mind picking this one up.
@calvinbrown085 Did you end up working on this?
@YuvalItzchakov I have not yet, I have not found the time! If someone else would like to pick this up please feel free!
@calvinbrown085 so I will take it :)
Hey @satansk are you still working on it? If not would you mind me taking it from you?
@CucumisSativus I almost forget about this issue, but I will continue to work on this :)
@satansk so, good luck with it! :)
Hey @satansk, are You working on that issue? If not, can I take it?
@wojciechUrbanski go ahead, it's yours :)
Happy to add it if no one is doing it.
This can be closed now. Thanks.
Most helpful comment
You're spoiling the fun with these easy implementations!