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

Add useful Semigroup and Monoid instances for Validation #172

Closed
chshersh opened this issue Jul 18, 2019 · 1 comment · Fixed by #175
Closed

Add useful Semigroup and Monoid instances for Validation #172

chshersh opened this issue Jul 18, 2019 · 1 comment · Fixed by #175
Labels
enhancement New feature or request extra Relude.Extra

Comments

@chshersh
Copy link
Contributor

Currently our Validation doesn't have Semigroup and Monoid instances. It would be a great idea to add them. And also write better documentation for the Validation module with use cases 🙂 I also noticed that we have our own implementation of liftA2 but it's inefficient compared to <*> so it's better just to remove it.

instance (Semigroup e, Semigroup a) => Semigroup (Validation e a) where
    x <> y = liftA2 (<>) x y

instance (Semigroup e, Monoid a) => Monoid (Validation e a) where
    mempty = Success mempty
@chshersh chshersh added enhancement New feature or request extra Relude.Extra labels Jul 18, 2019
@chshersh chshersh added this to the v0.6.0.0: Refinement milestone Jul 18, 2019
mauriciofierrom added a commit to mauriciofierrom/relude that referenced this issue Jul 28, 2019
mauriciofierrom added a commit to mauriciofierrom/relude that referenced this issue Jul 28, 2019
@mauriciofierrom
Copy link
Contributor

mauriciofierrom commented Jul 28, 2019

Hello! I've opened a PR to address this. Could you please elaborate on

And also write better documentation for the Validation module with use cases

With examples maybe? I would like to try and help with that too 🙂

vrom911 pushed a commit that referenced this issue Aug 6, 2019
* [#172] Add Semigroup and Monoid instances to Validation

* Changes as per code review

* Little correction in Examples

* Add 'How to use' section to Validation module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extra Relude.Extra
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants