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

Additions: "Also" for side-effects and "debug" for printing debug messages #33

Merged
merged 2 commits into from
Mar 5, 2022

Conversation

nicorichard
Copy link
Contributor

Creates a debug function which can be used to log print statements to aid in debugging

e.g.

Gen
    .from(1...5)
    .debug()
    .map { $0 * 2 }
    .debug("*2")
    .take(5)

will produce:

14:22:42.205: [GenythingTests/GenDebugTests.swift:8] -> 5
14:22:42.205: [*2] -> 10
14:22:42.205: [GenythingTests/GenDebugTests.swift:8] -> 4
14:22:42.205: [*2] -> 8
14:22:42.205: [GenythingTests/GenDebugTests.swift:8] -> 3
14:22:42.205: [*2] -> 6

In addition I've added also to the toolkit which was used to make debug possible.

also can be used to introduce side-effects during value generation, something that I wouldn't really recommend unless perhaps to implement a different logging/debugging solution.

@nicorichard nicorichard merged commit 2752554 into main Mar 5, 2022
@nicorichard nicorichard deleted the debug branch March 5, 2022 22:32
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.

1 participant