Hi! Is there a way to omit clojure.spec.alpha/problems from printing in the REPL? After Detected x Errors
, my REPL vomits forth the contents of :clojure.spec.alpha/problems
. From what I could tell looking at your code, I don't think expound is the one doing this. Regardless, I need to omit that, as it's redundant, unreadable, and can get oppressively long. (The part expound prints beforehand is doing its job very nicely, however!)
Hi @alex.joseph.whitt! What version of Clojure are you using in your REPL?
If memory serves, I think this behavior is configured by the Clojure REPL itself. I think it can be configured, but how to do so depends on your version, I think
;; CIDER 0.22.0snapshot (package: 20190419.1025), nREPL 0.6.0 ;; Clojure 1.9.0, Java 1.8.0_202
I don't mind upgrading if that helps. Thank you for the quick response!
Cool, one sec
I think that upgrading to Clojure 1.10 may just fix if you want to give that a shot. Hopefully that won’t cause any other issue for you 🤞
are you using the REPL in cider or in the console?
@alex.joseph.whitt I see the behavior you describe in clojure 1.9.0
clj -Sdeps '{:deps {org.clojure/core.specs.alpha {:mvn/version "0.2.44"} speculative {:mvn/version "0.0.3"} expound {:mvn/version "0.7.2"} org.clojure/
test.check {:mvn/version "0.9.0"} org.clojure/clojure {:mvn/version "1.9.0"}}}'
Clojure 1.9.0
user=> (require '[clojure.spec.test.alpha :as st] '[clojure.spec.alpha :as s] '[expound.alpha :as expound])
nil
user=> (set! s/*explain-out* expound/printer)
#object[expound.alpha$printer 0x70807224 "expound.alpha$printer@70807224"]
user=> (st/instrument)
[expound.printer/indent expound.paths/prefix-path? expound.alpha/explain-result-str expound.alpha/specs expound.alpha/explain-results expound.alpha/error-message expound.alpha/cu
stom-printer expound.paths/kvps-path? expound.alpha/explain-results-str expound.alpha/value-in-context expound.printer/pprint-str expound.alpha/expound expound.alpha/defmsg expou
nd.alpha/expound-str expound.paths/kps-path? expound.alpha/printer expound.alpha/explain-result expound.problems/summary-form expound.printer/no-trailing-whitespace]
user=> (defn)
but not with 1.10.0
clj -Sdeps '{:deps {org.clojure/core.specs.alpha {:mvn/version "0.2.44"} speculative {:mvn/version "0.0.3"} expound {:mvn/version "0.7.2"} org.clojure/
test.check {:mvn/version "0.9.0"} org.clojure/clojure {:mvn/version "1.10.0"}}}'
Clojure 1.10.0
user=> (require '[clojure.spec.test.alpha :as st] '[clojure.spec.alpha :as s] '[expound.alpha :as expound])
nil
user=> (set! s/*explain-out* expound/printer)
#object[expound.alpha$printer 0x63429932 "expound.alpha$printer@63429932"]
user=> (st/instrument)
[expound.printer/indent expound.paths/prefix-path? expound.alpha/explain-result-str expound.alpha/specs expound.alpha/explain-results expound.alpha/error-message expound.alpha/cu
stom-printer expound.paths/kvps-path? expound.alpha/explain-results-str expound.alpha/value-in-context expound.printer/pprint-str expound.alpha/expound expound.alpha/defmsg expou
nd.alpha/expound-str expound.paths/kps-path? expound.alpha/printer expound.alpha/explain-result expound.problems/summary-form expound.printer/no-trailing-whitespace]
user=> (defn)
but the complexity here is that this is just in the clj
REPL which implements a specific handler for errors. leiningen
and nrepl may have different behaviors by default, since they don’t use the same error handler by default as clj
sorry, i realize that’s a complex answer for a simple question, but unfortunately, error handling in REPLs is complicated by the array of tools we have.
You can try the following:
1. Upgrade to Clojure 1.10.0
2. If you’re using lein
, consider upgrading that
3. See if you can get the correct behavior on the console REPL (either clj
or lein repl
)
4. If that works correctly, see if you can get the correct behavior in a CIDER REPL
Hope that helps!
The update was a bit painful but it fixed the issue! Thank you so much for looking into this.