You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 a Monoid rather than Semigroup constraint could allow this in the list monoid with something like
liftA2 _ (Failure e1) m =Failure$ e1 <>case m ofFailure es -> es
Success _ ->mempty
The text was updated successfully, but these errors were encountered:
In think in principle, neither Semigroup nor Monoid is the right underlying class when taking laziness into account.
classAccumulateawhereaccum::a->Maybea->anewtypeSemia=Semi{unSemi::a}newtypeMona=Mon{unMon::a}instanceSemigroupa=>Accumulate (Semia) where
accum a (Just b) = a <> b
accum a Nothing= a
instanceMonoida=>Accumulate (Mona) where
accum a mb = a <>maybememptyid mb
Not that I know of. It's an oddball. I think it would likely be best to just add the lazier, Monoid-based version of Validation as Data.Validation.Lazy.
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: