Open srid opened 5 years ago
Here's a good example of where this is confusing:
import Control.Lens
import Data.Validation
failure :: Validation [String] String
failure = _Failure # ["failure"]
success :: Validation [String] String
success = _Success # "success"
main :: IO ()
main = do
print $ failure <> success
print $ success <> success
print $ failure <> failure
I get:
Success "success"
Success "success"
Failure ["failure","failure"]
but I expect to get:
Failure ["failure"]
Success "success"
Failure ["failure","failure"]
The
<>
operator on validation values ends up ignoring failures, which seems like something unintended. I discovered this while debugging a validation related bug. Is there a reasonValidation
is an instance ofSemigroup
at all?