structural-typing.api.custom
Functions useful when overriding default behavior.
explanation
(explanation oopsie)
Convert an oopsie into a string explaining the error, using the :predicate-explainer
within it.
explanations
(explanations oopsies)
Convert a collection of oopsies into a lazy sequence of explanatory strings. See explanation.
friendly-function-name
(friendly-function-name f)
The argument should be a function or multimethod. Produce a string that will help a human understand which chunk o’ code is being referred to.
(d/friendly-function-name even?) => "even?"
(d/friendly-function-name #'even?) => "even?"
friendly-path
(friendly-path oopsie)
Convert the path into a string, with Specter components printed nicely.
mkfn:apply-to-each-explanation
(mkfn:apply-to-each-explanation handler)
Checking a single candidate may result in multiple errors (oopsies). The generated function applies the handler
to each oopsie’s explanation in turn. The handler
must be called for side-effect, as the generated function always returns nil
.
mkfn:apply-to-explanation-collection
(mkfn:apply-to-explanation-collection handler)
Checking a single candidate may result in multiple errors (oopsies). The generated function applies the handler
once to a collection of all the oopsie’s explanations. The value it returns is whatever the handler
returns; it is not guaranteed to be nil
.