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

Adds a andThen extension method to Validated to chain Validated #2539

Merged
merged 1 commit into from Sep 28, 2021

Conversation

magott
Copy link
Contributor

@magott magott commented Sep 27, 2021

As discussed on slack [https://kotlinlang.slack.com/archives/C5UPMM0A0/p1632399994123800] proposing a andThen method for Validated to easier chain Validations without going through withEither

Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

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

Looks awesome! Thank you @magott!! 🙏 👏 🥳
I left a nit, and a tip but this can also be merged as is 👍

@nomisRev nomisRev requested a review from a team September 28, 2021 07:56
@magott
Copy link
Contributor Author

magott commented Sep 28, 2021

Updated the PR with the suggestions implemented

@nomisRev nomisRev merged commit e30e298 into arrow-kt:main Sep 28, 2021
@nomisRev
Copy link
Member

nomisRev commented Sep 28, 2021

Thanks for the contribution @magott !! 🙌

@nomisRev
Copy link
Member

Should become available in 1.0.1 with Kotlin 1.5.31 soon ;)

@magott magott deleted the validated-andthen branch September 29, 2021 21:45
*
* suspend fun main() {
* val houseNumber = config.parse(Read.intRead, "house_number").andThen { number ->
* if (number >= 0) Valid(0)
Copy link

Choose a reason for hiding this comment

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

@magott should it rather be Valid(number) here?

Copy link
Member

Choose a reason for hiding this comment

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

🕵️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

haha, surprised there weren't more errors in code written in doc. Do you want a new PR @nomisRev ? Or will you just fix it in main?

Copy link

Choose a reason for hiding this comment

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

Looks great! Good job 👏 Looking forward to delete the extension method from our code ❤️

Copy link
Member

Choose a reason for hiding this comment

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

I'll fix it directly in main.

This is actually why I'm working on this Dokka Plugin: https://github.com/nomisRev/AnkDokkaPlugin/pull/7/files
I think we can already do it today too with our current setup, but if we wrote tests instead of examples than we could catch these mistakes on CI as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think the docs compile as part of the build, so this isn't an error as such. Just a logical bug.

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.

None yet

4 participants