object
validatedï
Types and predicates for type-checking and handling lists of validation terms. Inspired by Scala Cats and Kotlin Arrow.
logtalk_load(validations(loader))static, context_switching_calls
Type-checking support: Defines a
validated(ValueType, ErrorType)type for checking validation terms where the value and error terms must be of the given types.QuickCheck support: Defines clauses for the
type::arbitrary/1-2,arbitrary::shrinker/1,arbitrary::shrink/3, andarbitrary::edge_case/2predicates to allow generating random values for thevalidated(ValueType, ErrorType)type.
Public predicatesï
valids/2ï
Returns the values stored in validation terms that hold valid values.
staticvalids(Validations,Values)valids(+list(validation),-list) - oneinvalids/2ï
Returns a flattened list with all errors stored in invalid validation terms.
staticinvalids(Validations,Errors)invalids(+list(validation),-list) - onepartition/3ï
Retrieves and partitions valid values and flattened accumulated errors from validation terms.
staticpartition(Validations,Values,Errors)partition(+list(validation),-list,-list) - onemap/3ï
Applies a closure to each list element to generate validation terms and returns a pair Values-Errors accumulating all valid values and all errors in one pass.
staticmap(Closure,Terms,ValuesErrors)map(2,*,*)map(+callable,+list,--compound) - onemap/4ï
Applies a closure to each list element to generate validation terms and returns valid values and accumulated errors in one pass.
staticmap(Closure,Terms,Values,Errors)map(2,*,*,*)map(+callable,+list,-list,-list) - onesequence/2ï
Sequences a list of validation terms into a single validation term, accumulating all errors.
staticsequence(Validations,Validation)sequence(+list(validation),--nonvar) - onetraverse/3ï
Applies a closure to each list element to generate validation terms and then sequences them, accumulating all errors.
statictraverse(Closure,Terms,Validation)traverse(2,*,*)traverse(+callable,+list,--nonvar) - oneProtected predicatesï
(no local declarations; see entity ancestors if any)
Private predicatesï
(no local declarations; see entity ancestors if any)
Operatorsï
(none)
See also