Cats: Missing functions for RWST

Created on 23 Jun 2018  路  13Comments  路  Source: typelevel/cats

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))

good first issue help wanted low-hanging fruit

Most helpful comment

You're spoiling the fun with these easy implementations!

All 13 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fosskers picture fosskers  路  3Comments

tg44 picture tg44  路  4Comments

kailuowang picture kailuowang  路  3Comments

SimY4 picture SimY4  路  4Comments

TrustNoOne picture TrustNoOne  路  3Comments