Created
July 6, 2018 19:56
-
-
Save bhb/649c46ac6dfa290fa6a62bb96fb66f62 to your computer and use it in GitHub Desktop.
Example of a printer that is more suited for instrumentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (require '[expound.alpha :as expound] | |
'[clojure.spec.alpha :as s]) | |
nil | |
user=> (set! s/*explain-out* (expound/custom-printer {:print-specs? false :show-valid-values? true})) | |
#object[expound.alpha$custom_printer$fn__895 0x38b972d7 "expound.alpha$custom_printer$fn__895@38b972d7"] | |
user=> (let [{:keys 4} foo] x) | |
CompilerException clojure.lang.ExceptionInfo: Call to clojure.core/let did not conform to spec: | |
-- Spec failed -------------------- | |
([{:keys 4} foo] x) | |
^^^^^^^^^ | |
should satisfy | |
simple-symbol? | |
or | |
vector? | |
-- Spec failed -------------------- | |
([{:keys 4} foo] x) | |
^ | |
should satisfy | |
vector? | |
------------------------- | |
Detected 2 errors | |
#:clojure.spec.alpha{:problems ({:path [:args :bindings :binding :sym], :pred clojure.core/simple-symbol?, :val {:keys 4}, :via [:clojure.core.specs.alpha/bi | |
ndings :clojure.core.specs.alpha/bindings :clojure.core.specs.alpha/binding :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/binding-form :clo | |
jure.core.specs.alpha/local-name], :in [0 0]} {:path [:args :bindings :binding :seq], :pred clojure.core/vector?, :val {:keys 4}, :via [:clojure.core.specs.al | |
pha/bindings :clojure.core.specs.alpha/bindings :clojure.core.specs.alpha/binding :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/binding-for | |
m :clojure.core.specs.alpha/seq-binding-form], :in [0 0]} {:path [:args :bindings :binding :map :keys], :pred clojure.core/vector?, :val 4, :via [:clojure.cor | |
e.specs.alpha/bindings :clojure.core.specs.alpha/bindings :clojure.core.specs.alpha/binding :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/b | |
inding-form :clojure.core.specs.alpha/map-binding-form :clojure.core.specs.alpha/map-special-binding :clojure.core.specs.alpha/keys], :in [0 0 :keys]}), :spec | |
#object[clojure.spec.alpha$regex_spec_impl$reify__2436 0x73aff8f1 "clojure.spec.alpha$regex_spec_impl$reify__2436@73aff8f1"], :value ([{:keys 4} foo] x), :ar | |
gs ([{:keys 4} foo] x)}, compiling:(NO_SOURCE_PATH:4:1) | |
user=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment