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