A clojure.spec form pretty printer for Clojure and ClojureScript.
Extends fipp pretty printer with rules for printing clojure.spec forms.
This is just a simple library that does this one thing.
Checkout inspectable or expound if you are looking for spec browsing and explain-data analyzing.
To include the library add the following to your :dependencies
[pretty-spec "0.1.3"]
user> (require '[clojure.spec.alpha :as s])
nil
user> (require '[pretty-spec.core :as pspec])
nil
user> (pspec/pprint (s/form 'clojure.core/let))
; (clojure.spec.alpha/fspec
; :args (clojure.spec.alpha/cat
; :bindings :clojure.core.specs.alpha/bindings
; :body (clojure.spec.alpha/* clojure.core/any?))
; :ret clojure.core/any?
; :fn nil)
nil
Comparing to vanilla clojure.pprint:
user> (clojure.pprint/pprint (s/form 'clojure.core/let))
; (clojure.spec.alpha/fspec
; :args
; (clojure.spec.alpha/cat
; :bindings
; :clojure.core.specs.alpha/bindings
; :body
; (clojure.spec.alpha/* clojure.core/any?))
; :ret
; clojure.core/any?
; :fn
; nil)
nil
Pretty-spec pprint accepts the same options as fipp pprint plus :ns-aliases which you can use to make your pprint even more redable.
user> (pspec/pprint (s/form 'clojure.core/let)
{:ns-aliases {"clojure.spec.alpha" "s"
"clojure.core.specs.alpha" "score"
"clojure.core" nil}})
; (s/fspec
; :args (s/cat :bindings :score/bindings :body (s/* any?))
; :ret any?
; :fn nil)
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close