-
Notifications
You must be signed in to change notification settings - Fork 28
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 a lazier version #53
Comments
Good point! |
In think in principle, neither class Accumulate a where
accum :: a -> Maybe a -> a
newtype Semi a = Semi { unSemi :: a }
newtype Mon a = Mon { unMon :: a }
instance Semigroup a => Accumulate (Semi a) where
accum a (Just b) = a <> b
accum a Nothing = a
instance Monoid a => Accumulate (Mon a) where
accum a mb = a <> maybe mempty id mb |
Has this class been published? |
Not that I know of. It's an oddball. I think it would likely be best to just add the lazier, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case of failure, one may be interested in only the first few errors, but
Validation
requires that everything be checked regardless. A version with aMonoid
rather thanSemigroup
constraint could allow this in the list monoid with something likeThe text was updated successfully, but these errors were encountered: