Skip to content

[#221] Refactor Validation module#224

Merged
vrom911 merged 1 commit intomasterfrom
chshersh/221-Refactor-Validation-module
Oct 30, 2019
Merged

[#221] Refactor Validation module#224
vrom911 merged 1 commit intomasterfrom
chshersh/221-Refactor-Validation-module

Conversation

@chshersh
Copy link
Copy Markdown
Contributor

Resolves #221

I've also added Monad instance with custom type errors for Validation because why not if we already added a lot of such instances.

@chshersh chshersh added doc README, Haddock documentation, tutorials extra Relude.Extra labels Oct 30, 2019
@chshersh chshersh requested a review from vrom911 as a code owner October 30, 2019 13:15
@chshersh chshersh self-assigned this Oct 30, 2019
Copy link
Copy Markdown
Contributor

@hint-man hint-man bot left a comment

Choose a reason for hiding this comment

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

Do you know why your PR is still not approved? Because I chose not to approve it. But they will.

Copy link
Copy Markdown
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

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

So cool! And another custom type error! 👍

short-circuting on the first error so you can display all possible errors at
once. Common use-cases include:

1. Validating each input a form with multiple inputs.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"a form" seems to be out of the context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah, probably I missed a few words...

errors inside 'Failure'.
4. 'Semigroup': accumulate both 'Failure' and 'Success' with '<>'.
5. 'Monoid': 'Success' that shores 'mempty'.
6. 'Alternative': return first 'Success' or accumulate all errors inside 'Failure'.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔥

@chshersh chshersh force-pushed the chshersh/221-Refactor-Validation-module branch from d7c5bd7 to d657015 Compare October 30, 2019 13:24
@chshersh chshersh force-pushed the chshersh/221-Refactor-Validation-module branch from d657015 to 238af33 Compare October 30, 2019 13:26
@vrom911 vrom911 merged commit c1e17cc into master Oct 30, 2019
@vrom911 vrom911 deleted the chshersh/221-Refactor-Validation-module branch October 30, 2019 14:53
@josephcsible
Copy link
Copy Markdown
Contributor

I notice that the doctests now only test laziness for *>, but they used to test it for <*, <*>, and liftA2 too. Was this intentional?

@chshersh chshersh added the Hacktoberfest https://hacktoberfest.digitalocean.com/ label Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc README, Haddock documentation, tutorials extra Relude.Extra Hacktoberfest https://hacktoberfest.digitalocean.com/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor Validation module

3 participants