h$MK      !"#$%&'()*+,-./0123456789:;<=>?@A Safe-Inferred;BCDEFGHISafeaJSafe38 validaLike K8, but accumulates failures upon applicative composition.valida.Represents a validation failure with an error.valida)This behaves similar to the K" semigroup. i.e Returns the first . But also accumulates s.ExamplesSuccess 1 <> Success 2 Success 1Failure "error" <> Success 1 Success 1Success 2 <> Failure "error" Success 2$Failure ["err1"] <> Failure ["err2"]Failure ["err1","err2"]Vvalida pureQ is a  value.(<*>)W behaves similar to K/, but accumulates failures instead of stopping.Examplespure 2 :: Validation String Int Success 2Success (+1) <*> Success 4 Success 5 Success (+1) <*> Failure "error"Failure "error"%Failure ["err1"] <*> Failure ["err2"]Failure ["err1","err2"]Xvalida fmapY maps given function over a  value, does nothing on  value.Examplesfmap (+1) (Success 2) Success 3fmap (+1) (Failure "error")Failure "error"Safe- valida Convert a  to an K.Given, Validation a b- Failure a is converted to Left a. Success b is converted to Right b.Examples0toEither (Success 'c' :: Validation String Char) Right 'c',toEither (Failure 42 :: Validation Int Char)Left 42valida Convert a K to an .Given,  Either e a-Left e is converted to  Failure e.Right a is converted to  Success a.Examples,fromEither (Right 'c' :: Either String Char) Success 'c''fromEither (Left 42 :: Either Int Char) Failure 42valida$Return True if the given value is a -value, False otherwise.valida$Return True if the given value is a -value, False otherwise. validaReturn the contents of a $-value or a default value otherwise.Examples0fromFailure 0 (Success 48 :: Validation Int Int)00fromFailure 0 (Failure 27 :: Validation Int Int)27 validaReturn the contents of a $-value or a default value otherwise.Examples0fromSuccess 0 (Success 48 :: Validation Int Int)480fromSuccess 0 (Failure 27 :: Validation Int Int)0 validaExtracts from a list of  all the  values, in order.Examplesfailures [Success 48, Failure "err1", Failure "err2", Success 2, Failure "err3"]["err1","err2","err3"]failures ([Success 1, Success 2, Success 3] :: [Validation String Int])[] validaExtracts from a list of $ all the Success elements, in order.Examplessuccesses [Success 1, Failure "err1", Failure "err2", Success 2, Failure "err3"][1,2]successes ([Failure "err1", Failure "err2", Failure "err3"] :: [Validation String Int])[] valida+Partitions a list of Either into two lists.All the Left elements are extracted, in order, to the first component of the output. Similarly the Right elements are extracted to the second component of the output. partitionValidations xs = (  xs,   xs)ExamplespartitionValidations [Success 1, Failure "err1", Failure "err2", Success 2, Failure "err3"](["err1","err2","err3"],[1,2])  Safe8> {validaAn applicative validator. Validates a predicate on an input when run and returns the  result.The type can be understood as- Validator e inp a ^ ^ ^------ The output type on successful validation | | Error type |-- The input on which validation is run Validators are run using the  runValidator! function. The result is of type Validation e a7, corresponding to the type params of the same name on .Note: All the primitive combinators (and derivative combinators) use the same type for inp and a. In those cases - upon successful validation, the input itself, wrapped in , is returned.Zvalida lmap[ runs given function on  input before applying it to the validator function. This is similar to the   type.rmap\ is the same as Y.Examples?runValidator (lmap fst (fixV $ failureIf (==2) "IsTwo")) (3, 2) Success 3?runValidator (lmap snd (fixV $ failureIf (==2) "IsTwo")) (3, 2)Failure ("IsTwo" :| []);runValidator (rmap (+1) (fixV $ failureIf (==2) "IsTwo")) 3Failure ("IsTwo" :| [])]valida memptyT. is a validator that always succeeds and uses unit as output type.Examples3runValidator (mempty :: Validator String Int ()) 42 Success ()^valida (<>)_ builds a validator that succeeds/ only if both of the given validators succeed.  Left-most& failure is returned, other validator  is not used* if one fails. If all validators succeed,  right-most success is returned.Examples'let v1 = fixV (failureIf (==2) "IsTwo")'let v2 = fixV (failureIf even "IsEven")runValidator (v1 <> v2) 5 Success 5runValidator (v1 <> v2) 4Failure ("IsEven" :| [])runValidator (v1 <> v2) 2Failure ("IsTwo" :| [])`valida pureQ creates a + that always yields given value wrapped in , ignoring its input.(<*>)W# runs 2 validators to obtain the 2  results and combines them with W. This can be understood as- (Validator ff) <*> (Validator v) = Validator (\inp -> ff inp <*> v inp) i.e Run ff and v on the input, and compose the  results with W.ExamplesrunValidator (pure 5) 42 Success 5runValidator (const <$> failureIf (==2) "IsTwo" <*> failureIf even "IsEven") 5 Success 5runValidator (const <$> failureIf (==2) "IsTwo" <*> failureIf even "IsEven") 4Failure ("IsEven" :| [])runValidator (const <$> failureIf (==2) "IsTwo" <*> failureIf even "IsEven") 2Failure ("IsTwo" :| ["IsEven"])avalida fmapY maps given function over the  result by re-using Y on it.Examples4runValidator (fmap (+1) (failureIf (==2) "IsTwo")) 3 Success 44runValidator (fmap (+1) (failureIf (==2) "IsTwo")) 2Failure ("IsTwo" :| [])b5Combinators and utilities for building and combining s(c) TotallyNotChase, 2021MITtotallynotchase42@gmail.comStablePortableSafe?J-validaBuild a rule that fails with given error if the given predicate succeeds. failureIf predc =  (c . predc)Examples*runValidator (failureIf (>0) "Positive") 5Failure ("Positive" :| [])*runValidator (failureIf (>0) "Positive") 0 Success 0-runValidator (failureIf (>0) "Positive") (-1) Success (-1)validaBuild a rule that fails with given error #unless the given predicate succeeds. failureUnless predc =  (c . predc)Examples1runValidator (failureUnless (>0) "NonPositive") 5 Success 51runValidator (failureUnless (>0) "NonPositive") 0Failure ("NonPositive" :| [])4runValidator (failureUnless (>0) "NonPositive") (-1)Failure ("NonPositive" :| [])validaLike  but uses Unit as the  error type. failureIf' predc =  (c . predc) label (M# (err :| [])) (failureIf' predc) =  predc errExamples runValidator (failureIf' (>0)) 5 Failure () runValidator (failureIf' (>0)) 0 Success 0#runValidator (failureIf' (>0)) (-1) Success (-1)validaLike  but uses Unit as the  error type. failureUnless' predc =  (c . predc) label (M' (err :| [])) (failureUnless' predc) =  predc errExamples$runValidator (failureUnless' (>0)) 5 Success 5$runValidator (failureUnless' (>0)) 0 Failure ()'runValidator (failureUnless' (>0)) (-1) Failure ()valida!Build an equality rule for value.  mustBe x =  (==x)valida"Build an equality rule for length.  ofLength x =  ((==x) . d)valida(Build a minimum length (inclusive) rule. minLengthOf x =  ((>=n) . d)valida(Build a maximum length (inclusive) rule. maxLengthOf n =  ((<=n) . d)valida(Build a minimum length (inclusive) rule. lengthAbove x =  (x + 1) lengthAbove x =  ((>n) . d)valida(Build a maximum length (inclusive) rule. lengthBelow x =  (x - 1) lengthBelow x =  ((=x)valida'Build a maximum value (inclusive) rule. maxValueOf x =  (<=x)valida'Build a minimum value (exclusive) rule. valueAbove x =  (x + 1) valueAbove x =  (>x)valida'Build a maximum value (exclusive) rule. valueBelow x =  (x - 1) valueBelow x =  ( m <= x && x <= n)!valida Build an g rule. onlyContains x =  (g x)"valida Build an h rule. atleastContains x =  (h x)#valida Build an i rule. mustContain x = " (==x) mustContain x =  (i x)$validaLike  but uses Unit as the  error type.%validaLike  but uses Unit as the  error type.&validaLike  but uses Unit as the  error type.'validaLike  but uses Unit as the  error type.(validaLike  but uses Unit as the  error type.)validaLike  but uses Unit as the  error type.*validaLike  but uses Unit as the  error type.+validaLike  but uses Unit as the  error type.,validaLike  but uses Unit as the  error type.-validaLike  but uses Unit as the  error type..validaLike  but uses Unit as the  error type./validaLike  but uses Unit as the  error type.0validaLike   but uses Unit as the  error type.1validaLike ! but uses Unit as the  error type.2validaLike " but uses Unit as the  error type.3validaLike # but uses Unit as the  error type.4validaBuild a validator that succeeds if given validator fails and vice versa.Note": This will set the output of the  to be the same as its input, thereby ignoring the original output.Examples0) "Positive")runValidator vald 5 Success 5runValidator vald 0Failure "NonPositive"runValidator vald (-1)Failure "NonPositive"5validaLike 4 but uses Unit as the  error type.6validaA synonym for 7:. Satisfies associativity law and hence forms a semigroup.7validaBuild a validator that succeeds if either8 of the given validators succeed. The first (left-most)  is returned. If both fail, the errors are combined. Other validator  is not used if first one succeeds. vald1 `orElse` (vald2 `orElse` vald3) = (vald1 `orElse` vald2) `orElse` vald3 8 e `orElse` vald = vald vald `orElse` 8 e = valdExampleslet vald = failureIf (>0) "Positive" `orElse` failureIf even "Even"runValidator vald 5 Success 5runValidator vald 4 Failure ("Positive" :| ["Even"])runValidator vald 0 Success 0runValidator vald (-1) Success (-1)8validaA  that always fails with supplied error. This is the identity of 7 (i.e 6). failV `7 ` vald = vald vald `7` failV = valdExamples3runValidator (failV :: Validator String Int Int) 42 Failure ""9validaBuild a validator that  only succeeds if both& of the given validators succeed. The first (left-most)* failure is yielded. If both succeed, the  right-most % result is returned. Other validator  is not used if first one fails.1This is the same as the semigroup operation (i.e _) on . vald1 `andAlso` (vald2 `andAlso` vald3) = (vald1 `andAlso` vald2) `andAlso` vald3 T `andAlso` vald = vald vald `andAlso` T = valdExampleslet vald = failureIf (>0) "Positive" `andAlso` failureIf even "Even"runValidator vald 5Failure ("Positive" :| [])runValidator vald (-2)Failure ("Even" :| [])runValidator vald (-1) Success (-1):validaBuild a validator that succeeds if any of the given validators succeed. If all fail, the errors are combined. The first (left-most) * is returned. If all fail, the errors are combined. Remaining validators  are not used once one succeeds.  satisfyAny = j 7  satisfyAny = k 7  satisfyAny = l 7 8  satisfyAny = m 7 8;validaBuild a validator that  only succeeds if all& of the given validators succeed. The first (left-most)) failure is yielded. If all succeed, the  right-most * result is returned. Remaining validators  are not used once one fails.  satisfyAll =    satisfyAll = j 9  satisfyAll = k 9  satisfyAll = l 9 T  satisfyAll = m 9 T<valida=Build a validator that runs given validator only if input is n.Yields  when input is o.Examples:runValidator (optionally (failureIf even "Even")) (Just 5)Success (Just 5);runValidator (optionally (failureIf even "Even"))) (Just 6)Failure ("Even" :| [])9runValidator (optionally (failureIf even "Even")) NothingSuccess Nothing- !"#$%&'()*+,-./0123456789:;<-45978;:6"#! 2()+'-&,$3*%1./0<653Core Validator builders, utilities, and combinators(c) TotallyNotChase, 2021MITtotallynotchase42@gmail.comStablePortableSafeKS=valida An alias to [ specialized to .=! allows a validator taking input b to work with input a, provided a function of type: a -> b.The new  first runs the selector on its input to obtain the validation target. Then, it runs the predicate on the target.If validation is successful, the the *original* output is put into the  result.ExamplesThis is the primary functions to build validators for product types. To validate a pair, the most basic product type, such that the first element is a non empty string, and the second element is a number greater than 9, you can use:let pairValidator = (,) <$> verify (notEmpty "EmptyString") fst <*> verify (failureIf (<10) "LessThan10") snd4You can then run the validator on your input, using :&runValidator pairValidator ("foo", 12)Success ("foo",12)#runValidator pairValidator ("", 12)Failure ("EmptyString" :| [])%runValidator pairValidator ("foo", 9)Failure ("LessThan10" :| [])"runValidator pairValidator ("", 9))Failure ("EmptyString" :| ["LessThan10"])>validaA synonym for = with its arguments flipped.?valida5Fix a validator's output to be the same as its input. fixV . fixV = p . fixV Y (M x) . fixV = Y (M x)Note: The primitive and derivative combinators already fix the validator output to be the same as its input.ExamplesThis is useful for regaining the input value in the output position after multiple Ys.Assume we have a validator that fails when input number is even-)let evenValidator = failureIf even "Even"This validator, when run, will yield its input value, wrapped in , if input is not even. ? would be redundant on this.However, if the output was Yed to be something else--let evenValidator' = fmap (:[]) evenValidatorNow the output type is `[Int]`. The value of the output is no longer the same as the input. If we needed to get the original input back into the output, ? would be the right choice.)let evenValidator'' = fixV evenValidator'evenValidator'' is now the exact same as evenValidator, which was fixed from the start.(("foo" <$ failureIf even "Even") <> ("bar" <$ failureIf (<0) "Negative")) `runValidator` 5 Success "bar"fixV (("foo" <$ failureIf even "Even") <> ("bar" <$ failureIf (<0) "Negative")) `runValidator` 5 Success 5@valida Relabel a  with a different error.Examples5let validator = label "NotEven" (failureUnless' even)runValidator validator 1Failure "NotEven"let validator = label "DefinitelyNotEven" (failureUnless even "NotEven")runValidator validator 1Failure "DefinitelyNotEven"AvalidaA synonym for @ with its arguments flipped.  !"#$%&'()*+,-./0123456789:;<=>?@A?=>@A  >5A6   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYWZ[W\]^_W`aW\bcW dW\efgW\hiW\jklmnlmopqW\rstuvwW xW yWz{W |W }W ~W W W W WWW\"valida-1.0.0-BkUwPLPJiynGfW5sXrQVvValidaValida.Combinators Paths_valida Valida.UtilsValida.ValidationValida.ValidationUtilsValida.ValidatorData.Functor.Contravariant Predicate Data.Foldablefold ValidationFailureSuccess validationvalidationConsttoEither fromEither isFailure isSuccess fromFailure fromSuccessfailures successespartitionValidations Validator runValidator failureIf failureUnless failureIf'failureUnless'mustBeofLength minLengthOf maxLengthOf lengthAbove lengthBelownotEmpty lengthWithin minValueOf maxValueOf valueAbove valueBelow valueWithin onlyContainsatleastContains mustContainmustBe' ofLength' minLengthOf' maxLengthOf' lengthAbove' lengthBelow' notEmpty' lengthWithin' minValueOf' maxValueOf' valueAbove' valueBelow' valueWithin' onlyContains'atleastContains' mustContain'negateVnegateV'orElsefailVandAlso satisfyAny satisfyAll optionallyverify-?>fixVlabelversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName neSingletonbase Data.EitherEitherData.Bifoldable bifoldMapGHC.Baseconst$fBifoldableValidation$fTraversableValidationData.Traversabletraversepure$fFoldableValidationfoldMapmempty$fSemigroupValidation$fApplicativeValidation<*>$fFunctorValidationfmap$fProfunctorValidator(profunctors-5.6.2-3WjoZ0635rf7ghFP8aUpMUData.Profunctor.Unsafelmaprmap$fMonoidValidator$fSemigroupValidator<>$fApplicativeValidator$fFunctorValidatorghc-prim GHC.ClassesnotlengthnullGHC.IxinRangeallanyelemfoldl1foldr1foldlfoldr GHC.MaybeJustNothingid