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

Added debug and debugChunks combinators #1727

Merged
merged 4 commits into from
Jan 7, 2020

Conversation

mpilquist
Copy link
Member

Fixes #1569

@mpilquist
Copy link
Member Author

@kubukoz How about this?

* res0: List[Int] = List(1, 2, 3, 4)
* }}}
*/
def debug(tag: String = "", logger: String => Unit = println(_)): Stream[F, O] =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe unsafeLogger?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the call site seems clunkier then -- s.debug(unsafeLogger = println)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking about side effects in the API. Arguably debug itself suggests that there will be something shady going on (e.g. toString for formatting), so maybe logger will also be an acceptable trade-off :)

@kubukoz
Copy link
Member

kubukoz commented Jan 4, 2020

Looks very nice, I'll see what it looks like in some examples :) Although I'm starting to get worried about having so many methods (4 of them being for debugging). Maybe it's a good time to think about putting them in some importable object (as pipes), or an implicit class...

@mpilquist
Copy link
Member Author

Yeah, it's a tricky balance. I could see getting rid of the format varieties, leaving two methods. And moving them to somewhere else kind of defeats the point of having a quick / easily accessible way of debugging.

@kubukoz
Copy link
Member

kubukoz commented Jan 5, 2020

Good point, it's probably a case of something you want to access quickly... but the API growing might eventually be a problem so we can think about it next time when adding new combinators :)

Just checked the new functions, everything seemed fine - 👍 from me

@SystemFw
Copy link
Collaborator

SystemFw commented Jan 7, 2020

How about only leaving the format* signatures instead? _ => "myTag" does not seem very problematic if O infers

@kubukoz
Copy link
Member

kubukoz commented Jan 7, 2020

@SystemFw it's more like "myTag: " + _, but fair enough

@mpilquist mpilquist merged commit 8629db0 into typelevel:master Jan 7, 2020
@mpilquist mpilquist added this to the 2.2.0 milestone Jan 18, 2020
@mpilquist mpilquist deleted the topic/debug branch February 18, 2020 12:56
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

Successfully merging this pull request may close these issues.

showLinesStdOut and friends could keep the elements unchanged
3 participants