Skip to content

Add useful Semigroup and Monoid instances for Validation #172

@chshersh

Description

@chshersh

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestextraRelude.Extra

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions