h$LJ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF Safe-InferredOGHIJKLMNSafeuOSafe38  valida-baseLike P8, but accumulates failures upon applicative composition. valida-base.Represents a validation failure with an error. valida-base)This behaves similar to the P" 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"][ valida-base pureV is a  value.(<*>)\ behaves similar to P/, 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"]] valida-base fmap^ maps given function over a  value, does nothing on  value.Examplesfmap (+1) (Success 2) Success 3fmap (+1) (Failure "error")Failure "error"Safe8 valida-base,The rule a Validator uses to run validation.?Contains a function that accepts the target type and returns a  result. The type- $ValidationRule (NonEmpty String) Int5, designates a rule that verifies the validity of an Int, and uses a value of type NonEmpty String( to represent error, in case of failure._ valida-baseThe validation predicate. valida-base'Low level function to manually build a ). You should use the combinators instead.ExamplesrunValidator (validate (vrule (\x -> if isDigit x then Success () else Failure "NotDigit"))) 'a'Failure "NotDigit"runValidator (validate (vrule (\x -> if isDigit x then Success () else Failure "NotDigit"))) '5' Success '5'` valida-base memptyY is a  that always succeeds.Examples"runValidator (validate mempty) 'a' Success 'a'a valida-base (<>)b creates a new  that only succeeds when both given rule succeed. Otherwise left-most failure is returned.ExamplesrunValidator (validate (failureIf even "IsEven" <> failureIf (>9) "GreaterThan9")) 5 Success 5runValidator (validate (failureIf even "IsEven" <> failureIf (>9) "GreaterThan9")) 4Failure ("IsEven" :| [])runValidator (validate (failureIf even "IsEven" <> failureIf (>9) "GreaterThan9")) 15Failure ("GreaterThan9" :| [])runValidator (validate (failureIf even "IsEven" <> failureIf (>9) "GreaterThan9")) 12Failure ("IsEven" :| [])_5Combinators and utilities for building and combining s.(c) TotallyNotChase, 2021MITtotallynotchase42@gmail.comStablePortableSafe0- valida-baseBuild a rule that fails with given error if the given predicate succeeds. failureIf predc =  (c . predc)Examples5runValidator (validate (failureIf (>0) "Positive")) 5Failure ("Positive" :| [])5runValidator (validate (failureIf (>0) "Positive")) 0 Success 08runValidator (validate (failureIf (>0) "Positive")) (-1) Success (-1) valida-baseBuild a rule that fails with given error #unless the given predicate succeeds. failureUnless predc =  (c . predc)Examples0) "NonPositive")) 5 Success 50) "NonPositive")) 0Failure ("NonPositive" :| [])?runValidator (validate (failureUnless (>0) "NonPositive")) (-1)Failure ("NonPositive" :| [])  valida-baseLike  but uses Unit as the  error type. failureIf' predc =   (c . predc) label (R# (err :| [])) (failureIf' predc) =  predc errExamples+runValidator (validate (failureIf' (>0))) 5 Failure ()+runValidator (validate (failureIf' (>0))) 0 Success 0.runValidator (validate (failureIf' (>0))) (-1) Success (-1)  valida-baseLike  but uses Unit as the  error type. failureUnless' predc =   (c . predc) label (R' (err :| [])) (failureUnless' predc) =  predc errExamples/runValidator (validate (failureUnless' (>0))) 5 Success 5/runValidator (validate (failureUnless' (>0))) 0 Failure ()2runValidator (validate (failureUnless' (>0))) (-1) Failure ()  valida-base!Build an equality rule for value.  mustBe x =  (==x)  valida-base"Build an equality rule for length.  ofLength x =  ((==x) . d)  valida-base(Build a minimum length (inclusive) rule. minLengthOf x =  ((>=n) . d) valida-base(Build a maximum length (inclusive) rule. maxLengthOf n =  ((<=n) . d) valida-base(Build a minimum length (inclusive) rule. lengthAbove x =   (x + 1) lengthAbove x =  ((>n) . d) valida-base(Build a maximum length (inclusive) rule. lengthBelow x =  (x - 1) lengthBelow x =  ((=x) valida-base'Build a maximum value (inclusive) rule. maxValueOf x =  (<=x) valida-base'Build a minimum value (exclusive) rule. valueAbove x =  (x + 1) valueAbove x =  (>x) valida-base'Build a maximum value (exclusive) rule. valueBelow x =  (x - 1) valueBelow x =  ( m <= x && x <= n) valida-base Build an g rule. onlyContains x =  (g x) valida-base Build an h rule. atleastContains x =  (h x) valida-base Build an i rule. mustContain x =  (==x) mustContain x =  (i x) valida-baseLike   but uses Unit as the  error type. valida-baseLike   but uses Unit as the  error type. valida-baseLike   but uses Unit as the  error type. valida-baseLike  but uses Unit as the  error type. valida-baseLike  but uses Unit as the  error type.  valida-baseLike  but uses Unit as the  error type.! valida-baseLike  but uses Unit as the  error type." valida-baseLike  but uses Unit as the  error type.# valida-baseLike  but uses Unit as the  error type.$ valida-baseLike  but uses Unit as the  error type.% valida-baseLike  but uses Unit as the  error type.& valida-baseLike  but uses Unit as the  error type.' valida-baseLike  but uses Unit as the  error type.( valida-baseLike  but uses Unit as the  error type.) valida-baseLike  but uses Unit as the  error type.* valida-baseLike  but uses Unit as the  error type.+ valida-base>Build a rule that succeeds if given rule fails and vice versa.Examples?let rule = negateRule "NonPositive" (failureIf (>0) "Positive")runValidator (validate rule) 5 Success 5runValidator (validate rule) 0Failure "NonPositive"!runValidator (validate rule) (-1)Failure "NonPositive", valida-baseLike + but uses Unit as the  error type.- valida-baseA synonym for .:. Satisfies associativity law and hence forms a semigroup.. valida-baseBuild a rule that succeeds if either of the given rules succeed. If both fail, the errors are combined. rule1 `orElse` (rule2 `orElse` rule3) = (rule1 `orElse` rule2) `orElse` rule3 / e `orElse` rule = rule rule `orElse` / e = ruleExampleslet rule = failureIf (>0) "Positive" `orElse` failureIf even "Even"runValidator (validate rule) 5 Success 5runValidator (validate rule) 4 Failure ("Positive" :| ["Even"])runValidator (validate rule) 0 Success 0!runValidator (validate rule) (-1) Success (-1)/ valida-baseA  that always fails with supplied error. This is the identity of . (i.e -).  falseRule `. ` rule = rule rule `.` falseRule = ruleExamples$runValidator (validate falseRule) 42 Failure ()0 valida-baseBuild a rule that  only succeeds if both? of the given rules succeed. The very first failure is yielded.1This is the same as the semigroup operation (i.e b) on . rule1 `andAlso` (rule2 `andAlso` rule3) = (rule1 `andAlso` rule2) `andAlso` rule3 Y `andAlso` rule = rule rule `andAlso` Y = ruleExampleslet rule = failureIf (>0) "Positive" `andAlso` failureIf even "Even"runValidator (validate rule) 5Failure ("Positive" :| [])!runValidator (validate rule) (-2)Failure ("Even" :| [])!runValidator (validate rule) (-1) Success (-1)1 valida-baseBuild a rule that succeeds if any of the given rules succeed. If all fail, the errors are combined.  satisfyAny = j .  satisfyAny = k .  satisfyAny = l . /  satisfyAny = m . /2 valida-baseBuild a rule that  only succeeds if all? of the given rules succeed. The very first failure is yielded.  satisfyAll = n  satisfyAll = j 0  satisfyAll = k 0  satisfyAll = l 0 Y  satisfyAll = m 0 Y3 valida-base3Build a rule that runs given rule only if input is o.Yields  when input is p.ExamplesrunValidator (validate (optionally (failureIf even "Even"))) (Just 5)Success (Just 5)runValidator (validate (optionally (failureIf even "Even"))) (Just 6)Failure ("Even" :| [])runValidator (validate (optionally (failureIf even "Even"))) NothingSuccess Nothing-  !"#$%&'()*+,-./0123- +,0/.21-   ) "$#*!(%&'3-5Safe9 4 valida-base Convert a  to an P.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 425 valida-base Convert a P 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 426 valida-base$Return True if the given value is a -value, False otherwise.7 valida-base$Return True if the given value is a -value, False otherwise.8 valida-baseReturn the contents of a $-value or a default value otherwise.Examples0fromFailure 0 (Success 48 :: Validation Int Int)00fromFailure 0 (Failure 27 :: Validation Int Int)279 valida-baseReturn 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: valida-baseExtracts 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])[]; valida-baseExtracts 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-base+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]) 456789:;<Safe8@= valida-baseAn applicative validator. Validates a predicate on an input when run and returns the  result.? valida-base=Convenience alias for functions that "select" a record field.q valida-base (<>)b? applies input over both validator functions, and combines the  results using b.ExamplesThis essentially reuses the b impl of . i.e Returns the first . But also accumulates s.+let v1 = validate (failureIf (==2) "IsTwo")+let v2 = validate (failureIf even "IsEven")runValidator (v1 <> v2) 5 Success 5runValidator (v1 <> v2) 4 Success 4runValidator (v1 <> v2) 2Failure ("IsTwo" :| ["IsEven"])r valida-base pureV creates a =+ that always yields given value wrapped in , ignoring its input.(<*>)\# runs 2 validators to obtain the 2  results and combines them with \. 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 \.ExamplesrunValidator (pure 5) 42 Success 5+let v1 = validate (failureIf (==2) "IsTwo")+let v2 = validate (failureIf even "IsEven")$runValidator (const <$> v1 <*> v2) 5 Success 5$runValidator (const <$> v1 <*> v2) 4Failure ("IsEven" :| [])$runValidator (const <$> v1 <*> v2) 2Failure ("IsTwo" :| ["IsEven"])s valida-base fmap^ maps given function over the  result by re-using ^ on it.Examples?runValidator (fmap (+1) (validate $ failureIf (==2) "IsTwo")) 3 Success 4?runValidator (fmap (+1) (validate $ failureIf (==2) "IsTwo")) 2Failure ("IsTwo" :| [])=t>?Primary Valida module, exporting everything needed to build validators.(c) TotallyNotChase, 2021MITtotallynotchase42@gmail.comStablePortableSafeJ(@ valida-baseBuild a validator from a  and a ?.The = first runs given selector on its input to obtain the validation target. Then, it runs the  on the target.If validation is successful, the validation target is put into the  result.ExamplesThis is the primary function for building validators for your record types. To validate a pair, the most basic record 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 ( LessThan108 :| []) >>> runValidator pairValidator ("", 9) Failure ( EmptyString :| [ LessThan10])A valida-baseA synonym for @ with its arguments flipped.B valida-base Relabel a  with a different error.Many combinators, like   and  -, simply return the given error value within NonEmpty upon failure. You can use B to override this return value.Examples0let rule = label "NotEven" (failureUnless' even)runValidator (validate rule) 1Failure "NotEven"let rule = label "DefinitelyNotEven" (failureUnless even "NotEven")runValidator (validate rule) 1Failure "DefinitelyNotEven"C valida-baseA synonym for B with its arguments flipped.D valida-base Relabel a = with a different error.Exampleslet validator = labelV "NotEven" (validate (failureUnless' even))runValidator validator 1Failure "NotEven"let validator = labelV "DefinitelyNotEven" (validate (failureUnless even "NotEven"))runValidator validator 1Failure "DefinitelyNotEven"E valida-baseA synonym for D with its arguments flipped.F valida-baseBuild a basic validator from a .The = runs the rule on its input. If validation is successful, the input is put into the  result. validate rule = @ rule u  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF?=>F@ABDCE549876;:<A5C6E0      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[Y\]Y^_`aYbcY^deYfgY^hijY^klY^mnoY^pqrsYftYfuYvwYfxYfyYfzYf{Yf|Yf}Yf~YfYYFY^(valida-base-0.2.0-HNh8G9pWsExKURHcoRZ8bQValidaValida.CombinatorsPaths_valida_base Valida.UtilsValida.ValidationValida.ValidationRuleValida.ValidationUtilsValida.Validator ValidationFailureSuccess validationvalidationConstValidationRulevrule 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' negateRule negateRule'orElse falseRuleandAlso satisfyAny satisfyAll optionallytoEither fromEither isFailure isSuccess fromFailure fromSuccessfailures successespartitionValidations Validator runValidatorSelectorverify-?>labellabelVvalidateversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName neSingletonbase Data.EitherEitherData.Bifoldable bifoldMapGHC.Baseconst$fBifoldableValidation$fTraversableValidationData.Traversabletraversepure$fFoldableValidation Data.FoldablefoldMapmempty$fSemigroupValidation$fApplicativeValidation<*>$fFunctorValidationfmap$fMonoidValidationRule$fSemigroupValidationRule<>ghc-prim GHC.ClassesnotlengthnullGHC.IxinRangeallanyelemfoldl1foldr1foldlfoldrfold GHC.MaybeJustNothing$fSemigroupValidator$fApplicativeValidator$fFunctorValidatorid