Repository navigation
#607: Add missing Show instances - #928
Conversation
…ow could be automatically derived for Tuples and case classes (see: https://github.com/milessabin/kittens), but ignored that possibility for now and just wrote an instance for Tuple2 to get this to work.
Current coverage is
|
|
Wonderful 👍. Thanks @matt-martin! See #631 for some discussion regarding the tuple instance generation that you brought up. |
|
👍 |
| def reset(implicit monoidL: Monoid[L], functorF: Functor[F]): WriterT[F, L, V] = | ||
| mapWritten(_ => monoidL.empty) | ||
|
|
||
| def show(implicit F: Show[F[(L, V)]]): String = F.show(run) |
There was a problem hiding this comment.
Hm we should be able to delete this line right?
There was a problem hiding this comment.
@adelbertc isn't the Show instance delegating to this method?
There was a problem hiding this comment.
Yeah, the Show instance is delegating to this method. I modeled this on the change that added a Show instance for OptionT (see: https://github.com/typelevel/cats/pull/600/files; and in particular:
Show instance is updated accordingly).
There was a problem hiding this comment.
Oh I see now, I read it as Show[(L, V)] - ignore me :-)
Randomly picked up this issue as I saw it was marked as "low hanging fruit" and I wanted to get more familiar with cats (and associated FP concepts).
One thing of note: I had to add a show instance for Tuple2 to make this work. I can't claim to be intimately familiar with Miles' Kittens project (see: https://github.com/milessabin/kittens), but it seemed like defining Show instances for Tuples and case classes would be particularly tedious and possibly something that Kittens/Shapeless could make a lot easier.
Without further ado, here is my initial attempt to address issue #607 and add a Show instance for WriterT.